Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Bruce Momjian
On Thu, Jul 4, 2013 at 02:00:24AM +0530, Dev Kumkar wrote: > On Thu, Jul 4, 2013 at 1:36 AM, Bruce Momjian wrote: > > And let's not forget that column aliases can be used as indentifiers in > queries: > > test=> SELECT 1 AS x > test-> ORDER BY x; > x

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 1:17 AM, Tom Lane wrote: > Quite aside from implementation difficulty, restricting the change to > just column aliases doesn't make it more palatable. You'd entirely lose > the argument that the change increases spec compliance, because the spec > is perfectly clear that a

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 1:36 AM, Bruce Momjian wrote: > And let's not forget that column aliases can be used as indentifiers in > queries: > > test=> SELECT 1 AS x > test-> ORDER BY x; > x > --- > 1 > (1 row) > > test=> SELECT 1 AS "X" >

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Bruce Momjian
On Wed, Jul 3, 2013 at 03:47:37PM -0400, Tom Lane wrote: > Alvaro Herrera writes: > > Dev Kumkar escribi�: > >> But what I am asking here is if an alias name is provided be it upper case, > >> lower case, or a mix then shouldn't it be preserved as as it is given. All > >> this talk is when alias

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Tom Lane
Alvaro Herrera writes: > Dev Kumkar escribió: >> But what I am asking here is if an alias name is provided be it upper case, >> lower case, or a mix then shouldn't it be preserved as as it is given. All >> this talk is when alias names are unquoted, when quoted then its standard >> behavior as see

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Thu, Jul 4, 2013 at 12:38 AM, Alvaro Herrera wrote: > Aliases are treated just like any other identifier. The downcasing > happens in the lexer (src/backend/parser/scan.l), which is totally > unaware of the context in which this is happening; so there's no way to > tweak the downcasing behavio

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Alvaro Herrera
Dev Kumkar escribió: > But what I am asking here is if an alias name is provided be it upper case, > lower case, or a mix then shouldn't it be preserved as as it is given. All > this talk is when alias names are unquoted, when quoted then its standard > behavior as seen in other databases. Aliase

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:50 PM, Tom Lane wrote: > > Any plans to fix this in next release or having a patch to fix this? > > No. > > This has been discussed (many times) before. There isn't any feasible > way to change this behavior without breaking an incredible amount of > code, much of which

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:35 PM, Thomas Kellerer wrote: > I wonder why you need that. I never had the requirement for that. > > Which driver/interface do you use that requires an alias to be all > uppercase? Looks like you didn't get me, am not saying aliases to be all upper case by default (BTW

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Bruce Momjian
On Wed, Jul 3, 2013 at 12:20:06PM -0400, Tom Lane wrote: > Dev Kumkar writes: > > Any plans to fix this in next release or having a patch to fix this? > > No. > > This has been discussed (many times) before. There isn't any feasible > way to change this behavior without breaking an incredible

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Tom Lane
Dev Kumkar writes: > Any plans to fix this in next release or having a patch to fix this? No. This has been discussed (many times) before. There isn't any feasible way to change this behavior without breaking an incredible amount of code, much of which isn't even under our control. The margina

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Thomas Kellerer
Dev Kumkar wrote on 03.07.2013 17:50: Note that adding quotes for aliases will be blessed by PostgreSQL and then those will be folded to upper case BUT this adds up to lot of changes in the SQL layer. I wonder why you need that. I never had the requirement for that. Which driver/interface do y

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 9:05 PM, Bruce Momjian wrote: > Yes, both the identifier names and alias names are folded to lower case. > I never thought of them as different, but you are right, they are, and > we are non-standard in both areas. Sorry. Any plans to fix this in next release or having a

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
On Wed, Jul 3, 2013 at 8:54 PM, Bruce Momjian wrote: > Agreed. The original poster specifically wanted "MYTABLE" and mytable > to be the same, not "mytable" and mytable. Postgres is certainly > non-standard in this area. I think the ability visiually distinguish > lower-case letters better tha

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Bruce Momjian
On Wed, Jul 3, 2013 at 09:02:20PM +0530, Dev Kumkar wrote: > On Wed, Jul 3, 2013 at 8:54 PM, Bruce Momjian wrote: > > Agreed. The original poster specifically wanted "MYTABLE" and mytable > to be the same, not "mytable" and mytable. Postgres is certainly > non-standard in this area

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Bruce Momjian
On Wed, Jul 3, 2013 at 04:16:41PM +0200, Thomas Kellerer wrote: > Theodore Petrosky, 03.07.2013 15:41: > > sorry, but you misunderstand. this is the correct behavior of SQL. > > > > It is part of the specification to do this. > > > > Not quite. The SQL standard requires folding to uppercase.

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Thomas Kellerer
Theodore Petrosky, 03.07.2013 15:41: > sorry, but you misunderstand. this is the correct behavior of SQL. > > It is part of the specification to do this. > Not quite. The SQL standard requires folding to uppercase. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make cha

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Theodore Petrosky
sorry, but you misunderstand. this is the correct behavior of SQL. It is part of the specification to do this. --- On Wed, 7/3/13, Dev Kumkar wrote: > From: Dev Kumkar > Subject: [SQL] Unquoted column names fold to lower case > To: pgsql-sql@postgresql.org > Date: Wednesday, July 3, 2013, 5:12

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Thanks! Sure this is not a bug. Just want to know if there is any possible way to achieve this. Reason being - need to change all the data layer of project where the column mapping has been done with Upper Case. Regards...

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Vik Fearing
On 07/03/2013 11:12 AM, Dev Kumkar wrote: > All unquoted identifiers are assumed by PostgreSQL to be lower case by > default. This means > - SELECT MY_COLUMN FROM my_table > - SELECT my_column FROM my_table > - SELECT my_column as MY_COLUMN FROM my_table > All refer to my_column and has column name

[SQL] Re: Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Resending On Wed, Jul 3, 2013 at 2:42 PM, Dev Kumkar wrote: > Hello, > > All unquoted identifiers are assumed by PostgreSQL to be lower case by > default. This means > - SELECT MY_COLUMN FROM my_table > - SELECT my_column FROM my_table > - SELECT my_column as MY_COLUMN FROM my_table > All refer

[SQL] Unquoted column names fold to lower case

2013-07-03 Thread Dev Kumkar
Hello, All unquoted identifiers are assumed by PostgreSQL to be lower case by default. This means - SELECT MY_COLUMN FROM my_table - SELECT my_column FROM my_table - SELECT my_column as MY_COLUMN FROM my_table All refer to my_column and has column name in lowercase as my_column. If the aliases ar