Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5779

Implicit column alias for single-column table function should work

    XMLWordPrintableJSON

Details

    Description

      Implicit column alias for single-column table function works only for UNNEST at the moment. But should work for every table function.

      For example, PostgreSQL:

      CREATE OR REPLACE FUNCTION fun() 
          RETURNS TABLE(col int)
         AS
      $$
      SELECT 1
      $$ LANGUAGE 'sql' VOLATILE;
      
      SELECT f.col, f FROM fun() as f;
       col | f 
      -----+---
         1 | 1
      (1 row)
      
      
      
      SELECT * FROM fun() as f;
       col 
      -----
         1
      (1 row)
      
      
      SELECT f FROM fun() as f;
       f 
      ---
       1
      (1 row)

       

      Calcite throws "Column 'i' not found in any table" exception for

      SELECT i FROM table(generate_series(1,2)) as i
      

      Where generate_series is user defined table function.

      Attachments

        Issue Links

          Activity

            People

              dmsysolyatin Dmitry Sysolyatin
              dmsysolyatin Dmitry Sysolyatin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: