Geeme
Geeme

Reputation: 415

Postgres - spaces and special characters in column name - how to select these in query

I have table in postgres test1 and columns "Username","# of Applications", "# of R Applications" .

when tried to query these using select query i get error-

select Username, "# of Applications","# of R Applications" from public.test1 

Error ERROR: column "username" does not exist LINE 1: select Username, "# of Applications" from public.test1...

Similarly for all other 2 columns as well....

how do i select these columns in select query?

Upvotes: 4

Views: 21749

Answers (1)

theRemix
theRemix

Reputation: 2224

Username is unquoted, so becomes username which the error suggests.

If your table has a column named Username, this should work

select "Username", "# of Applications","# of R Applications" from public.test1 

Upvotes: 10

Related Questions