pganalyze / pg_query

Ruby extension to parse, deparse and normalize SQL queries using the PostgreSQL query parser
BSD 3-Clause "New" or "Revised" License
778 stars 84 forks source link

(Select Into) doesn't return DDL tables #280

Closed OmarQunsul closed 1 year ago

OmarQunsul commented 1 year ago

select info creates a new table, but the parsed query doesn't return any tables for ddl_tables

parsed = PgQuery.parse "select * into new_users from users"
parsed.ddl_tables # [] which is wrong, it should contain ["new_users"]
parsed.dml_tables # [] correct

Reference: https://www.postgresql.org/docs/current/sql-selectinto.html

lfittl commented 1 year ago

Thanks for the report!

Could you review whether https://github.com/pganalyze/pg_query/pull/281 fixes this as you'd expect it to work?

OmarQunsul commented 1 year ago

@lfittl yes, it works :100: thank you