From: | David Raymond <David(dot)Raymond(at)tomtom(dot)com> |
---|---|
To: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | RE: Creating dynamically-typed tables using psycopg2's built-in formatting |
Date: | 2019-06-13 20:29:04 |
Message-ID: | VI1PR07MB579286D324415930A6E3E3A187EF0@VI1PR07MB5792.eurprd07.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
SELECT * FROM tbl;
returns a totally different table than
SELECT * FROM "tbl";
That's a little disconcerting.
For the capitalization thing basically what's going on is two things. (The way I understand it)
1) Postgres IS case sensitive.
2) When any query gets sent to the server, the server converts everything not inside quotes to lower case as step 1, _before_ trying to match names for tables, columns, functions, etc.
So if you send
SELECT * FROM TBL;
One of the first things the server does is change it to
select * from tbl;
at which point it will do a case-sensitive match for tbl
And if you run
SELECT * FROM "TBL";
it gets turned into
select * from "TBL";
at which point it will do a case-sensitive match for TBL
But in your case what is in quotes is the same as its lowercase version. So it "should" match up to the same thing. So if you are indeed getting different results from different tables then either my understanding is way off, or something weird is going on.
From | Date | Subject | |
---|---|---|---|
Next Message | Christophe Pettus | 2019-06-13 20:35:15 | Re: Creating dynamically-typed tables using psycopg2's built-in formatting |
Previous Message | Christophe Pettus | 2019-06-13 20:00:20 | Re: Creating dynamically-typed tables using psycopg2's built-in formatting |