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

From David Raymond
Subject RE: Creating dynamically-typed tables using psycopg2's built-informatting
Date
Msg-id VI1PR07MB579286D324415930A6E3E3A187EF0@VI1PR07MB5792.eurprd07.prod.outlook.com
Whole thread Raw
In response to Creating dynamically-typed tables using psycopg2's built-in formatting  (Daniel Cohen <daniel.m.cohen@berkeley.edu>)
Responses Re: Creating dynamically-typed tables using psycopg2's built-informatting  (Christophe Pettus <xof@thebuild.com>)
List 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 by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: Creating dynamically-typed tables using psycopg2's built-informatting
Next
From: Christophe Pettus
Date:
Subject: Re: Creating dynamically-typed tables using psycopg2's built-informatting