From: | Jim Nasby <jnasby(at)enova(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Elterman <melterman(at)enova(dot)com> |
Subject: | Re: regclass error reports improperly downcased |
Date: | 2013-11-08 20:13:46 |
Message-ID: | 527D45FA.2010700@enova.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 11/7/13 6:41 PM, Tom Lane wrote:
> Jim Nasby <jnasby(at)enova(dot)com> writes:
>> decibel(at)decina(dot)cashnetusa=# SELECT 'Moo'::regclass;
>> ERROR: relation "moo" does not exist at character 8
>
> That's doing what it's supposed to. Compare
>
> regression=# select 'Moo'::regclass;
> ERROR: relation "moo" does not exist
> LINE 1: select 'Moo'::regclass;
> ^
> regression=# select '"Moo"'::regclass;
> ERROR: relation "Moo" does not exist
> LINE 1: select '"Moo"'::regclass;
> ^
>
> The regclass input converter applies the same case-folding rules as
> the SQL parser does, ie, fold unless double-quoted.
Ahh, duh. Hrm... I ran across this because someone here got confused by this:
SELECT pg_total_relation_size( schema_name || '.' || relname ) FROM pg_stat_all_tables
ERROR: relation "moo" does not exist
Obviously the problem is that they needed to use quote_ident(), but I was hoping to make the error less confusing to deal with.
Perhaps we can add a hint? Something to the effect of "Do you need to use double-quotes or quote_ident()?"
--
Jim Nasby, Lead Data Architect (512) 569-9461
From | Date | Subject | |
---|---|---|---|
Next Message | Karl O. Pinc | 2013-11-08 20:18:44 | Re: backup.sgml-cmd-v003.patch |
Previous Message | Robert Haas | 2013-11-08 20:12:56 | Re: backup.sgml-cmd-v003.patch |