Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To add to the other answer, the behaviour of Postresql about case-sentivity of identifiers (table names and column names) is :</p> <ul> <li><strong>If the name is not quoted, it is converted to lowercase</strong>. Otherwise, it's left untouched.</li> <li>Afterwards, a <strong>case sensitive match</strong> is attempted.</li> </ul> <p>This applies not only for queries, but also for schema manipulation; in particular: table creation.</p> <p><a href="http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS" rel="noreferrer">The golden rule is consistency</a>: </p> <blockquote> <p>If you want to write portable applications you are advised to always quote a particular name or never quote it</p> </blockquote> <p>The posted problem arose, probably, because the tables and columns names were quoted at creation time (hence, they were not converted to lowercase). So, now they must be quoted (and case-sensitive) in all queries. </p> <p>Normally, all works as expected.</p> <pre><code>db=# create table Xxx (id integer); -- unquoted, will be converted to lowercase CREATE TABLE db=# select * from xXx; -- this works ok id ---- (0 rows) db=# create table "Xxxx" (id integer); -- will be left untouched CREATE TABLE db=# select * from xxxx; -- bad ERROR: relation "xxxx" does not exist LINE 1: select * from xxxx; db=# select * from Xxxx; -- bad ERROR: relation "xxxx" does not exist LINE 1: select * from Xxxx; ^ db=# select * from "Xxxx"; -- ok id ---- (0 rows) db=# \dt *xx* List of relations Schema | Name | Type | Owner --------+------+-------+---------- public | Xxxx | table | postgres public | xxx | table | postgres </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload