support AS with derived column list

Issue #1004 resolved
jek created an issue

in SQL,

SELECT * FROM tbl AS alias(colalias1, colalias2, colalias2)
-- or, more practically
SELECT * FROM tblfunction(123) AS res(cola, colb, colc)

SELECT * FROM (VALUES (1,'a'), (2, 'b')) AS t (num, alpha)
-- unspecified columns are returned but retain their original
-- name (possibly anonymous)
SELECT * FROM (VALUES (1,'a'), (2, 'b')) AS t (num)

Comments (3)

  1. Mike Bayer repo owner

    having trouble seeing the win in terms of SQLA column metadata, as we don't use names to identify things, would this look like:

    sometable.alias('somealias', {sometable.c.a:'p', sometable.c.b:'q', sometable.c.c:'r'})
    

    I'm not really seeing how that's very useful, as you'd use column objects and not strings to identify in a result set.

    For VALUES, that's not a builtin, there's a recipe at UsageRecipes/PGValues that can be adapted to name the columns in a certain way.

    I'd like to see more detail on how this would look, but at the moment I don't see any movement happening here so closing this for now.

  2. Log in to comment