0

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;
1
  • 1
    No, not possible. But this seems like a strange requirement and actually might indicate a bad (de-normalized) data model and the columns should actually be rows Commented Feb 10, 2020 at 17:42

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.