0

I have pgAdmin 4 and PostgreSQL 10.

I can't execute a query without quote marks i.e. I want to excute this

select * from table

but it only works if I use

select * from databasename."table"

How can I remove this restriction?

The name of the table is Complexitie. I was using postgresql the last year and I remember I could write queries in a simple way without mandatory syntax things like case senstive, mandatory quotes.

I read something about to setup arbitrary SQL queries en Postgres, but I can not find steps to configure it. thanks

  • What's the actual name of the table? – ypercubeᵀᴹ Jan 30 '19 at 00:09
  • There are reserved words like "table", "int", "sum" etc that can be used as identifiers only if enclosed by quotes. – Kondybas Jan 30 '19 at 00:25
  • 1
    You probably created those tables with double quotes which makes them case-sensitive "Person" is a different name than Person. I recommend to never use double quotes in SQL. –  Jan 30 '19 at 07:28
  • Thanks for you answer, the name of the table is Complexitie, I was using postgresql the last year and i remember I could write queries in a simple way without mandatory sintaxis things like case senstivie, mandatory quotes, I read something about to setup arbitrary sql queris en postgre, but I can not find steps to configure it. thanks – kevin vargas Jan 30 '19 at 13:26
  • 1
    As I said: you created the table using double quotes (e.g. create table "Complexitie" (...)) and thus the table name is now case sensitive and you are forced to use the double quotes all the time. The best thing would be to re-create the table(s) without double quotes: create table Complexitie (...). You can also check the many answers regarding that on Stackoverflow –  Jan 30 '19 at 13:51

1 Answers1

0

You probably used a keyword as name of your table. You will find the complete list of those keywords in that page of the documentation.

From my experience, the most frequent ones are columns named end or start.

Have a nice day

Arkhena
  • 1,560
  • 8
  • 15
  • Thanks for you answer, the name of the table is Complexitie, I was using postgresql the last year and i remember I could write queries in a simple way without mandatory sintaxis things like case senstivie, mandatory quotes, I read something about to setup arbitrary sql queris en postgre, but I can not find steps to configure it. thanks – kevin vargas Jan 30 '19 at 13:26
  • Oh, don't use case sensitive names for objects in Postgres or you indeed will have to use quoted identifiers. – Arkhena Jan 30 '19 at 14:22
  • as written in documentation https://www.postgresql.org/docs/11/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

    Key words and unquoted identifiers are case insensitive

    – Arkhena Jan 30 '19 at 14:24