RE: Creating dynamically-typed tables using psycopg2's built-informatting

Поиск
Список
Период
Сортировка
От David Raymond
Тема RE: Creating dynamically-typed tables using psycopg2's built-informatting
Дата
Msg-id VI1PR07MB579286D324415930A6E3E3A187EF0@VI1PR07MB5792.eurprd07.prod.outlook.com
обсуждение исходный текст
Ответ на Creating dynamically-typed tables using psycopg2's built-in formatting  (Daniel Cohen <daniel.m.cohen@berkeley.edu>)
Ответы Re: Creating dynamically-typed tables using psycopg2's built-informatting  (Christophe Pettus <xof@thebuild.com>)
Список 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
ifyou are indeed getting different results from different tables then either my understanding is way off, or something
weirdis going on.
 

В списке psycopg по дате отправления:

Предыдущее
От: Christophe Pettus
Дата:
Сообщение: Re: Creating dynamically-typed tables using psycopg2's built-informatting
Следующее
От: Christophe Pettus
Дата:
Сообщение: Re: Creating dynamically-typed tables using psycopg2's built-informatting