Re: BUG #12784: pg_relation_size has problems with case in index name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gibheer(at)zero-knowledge(dot)org
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12784: pg_relation_size has problems with case in index name
Date: 2015-02-18 19:43:32
Message-ID: 30858.1424288612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

gibheer(at)zero-knowledge(dot)org writes:
> I found a problem with indexes which have an uppercase letter in the name.
> You can reproduce it with the following statements:

> create table unfindable("Test" text);
> create index on unfindable("Test");
> \d unfindable
> select pg_relation_size('unfindable_Test_idx');

This isn't a bug. You need to double-quote the index name, just the same
as you would do at the SQL level.

regression=# create table unfindable("Test" text);
CREATE TABLE
regression=# create index on unfindable("Test");
CREATE INDEX
regression=# \d unfindable
Table "public.unfindable"
Column | Type | Modifiers
--------+------+-----------
Test | text |
Indexes:
"unfindable_Test_idx" btree ("Test")

regression=# select pg_relation_size('unfindable_Test_idx');
ERROR: relation "unfindable_test_idx" does not exist
LINE 1: select pg_relation_size('unfindable_Test_idx');
^
regression=# select pg_relation_size('"unfindable_Test_idx"');
pg_relation_size
------------------
8192
(1 row)

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Adrian Klaver 2015-02-18 21:25:27 Re: Fwd: Data corruption after restarting replica
Previous Message David G Johnston 2015-02-18 19:43:06 Re: BUG #12784: pg_relation_size has problems with case in index name