Thread: BUG #6413: pg_relation_size wont work on table with upper case chars

BUG #6413: pg_relation_size wont work on table with upper case chars

From
james@stev.org
Date:
The following bug has been logged on the website:

Bug reference:      6413
Logged by:          James Stevenson
Email address:      james@stev.org
PostgreSQL version: 8.4.9
Operating system:   Linux - Debian Squeeze
Description:=20=20=20=20=20=20=20=20


I suspect pg_relation_size has a tolower in it to a table name called
Attempts will not work with pg_relation_size

Both

pg_relation_size('Attempts')
and
pg_relation_size('attempts')

fails with no such table.

After table rename from Attempts to attempts it will work.

Re: BUG #6413: pg_relation_size wont work on table with upper case chars

From
Euler Taveira de Oliveira
Date:
On 28-01-2012 13:16, james@stev.org wrote:
> pg_relation_size('Attempts')
> and
> pg_relation_size('attempts')
>
pg_relation_size('"Attempts"')


--
   Euler Taveira de Oliveira - Timbira       http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Re: BUG #6413: pg_relation_size wont work on table with upper case chars

From
Heikki Linnakangas
Date:
On 28.01.2012 18:16, james@stev.org wrote:
> I suspect pg_relation_size has a tolower in it to a table name called
> Attempts will not work with pg_relation_size
>
> Both
>
> pg_relation_size('Attempts')
> and
> pg_relation_size('attempts')
>
> fails with no such table.
>
> After table rename from Attempts to attempts it will work.

Try double-quoting the table name, within the single-quotes:
pg_relation_size('"Attempts"').

This is explained in the context of nextval() function at:

http://www.postgresql.org/docs/9.1/static/functions-sequence.html

Looks like the manual page on pg_relation_size(), or "Object Identifier
Types" where the regclass datatype is otherwise explained, don't mention
anything about the double-quoting. Patches to improve that are welcome..

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Re: BUG #6413: pg_relation_size wont work on table with upper case chars

From
"James Stevenson"
Date:
VGhhdCBzZWVtcyB0byB3b3JrLg0KDQp0aGFua3MNCg0KLS0tLS1PcmlnaW5h
bCBNZXNzYWdlLS0tLS0NCkZyb206IEhlaWtraSBMaW5uYWthbmdhcyBbbWFp
bHRvOmhlaWtraS5saW5uYW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