简体   繁体   中英

Accessing PostgreSQL Fields via Indexing

Is there a way in PostgreSQL to access fields without explicitly providing the column name? For example, instead of the statement:

select (col1,col2,col3,...col42) from foo_table;

there's a (possible) alternative of:

select (1:42) from foo_table;

There is no such syntax in Postgres' SQL.

You could always resort to having code that dynamically constructs the query for you before executing it, but that's about as good as it will get.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM