Re: BUG #12784: pg_relation_size has problems with case in index name - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #12784: pg_relation_size has problems with case in index name
Date
Msg-id 30858.1424288612@sss.pgh.pa.us
Whole thread Raw
In response to BUG #12784: pg_relation_size has problems with case in index name  (gibheer@zero-knowledge.org)
List pgsql-bugs
gibheer@zero-knowledge.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

pgsql-bugs by date:

Previous
From: David G Johnston
Date:
Subject: Re: BUG #12784: pg_relation_size has problems with case in index name
Next
From: Alexey Klyukin
Date:
Subject: recurring SSL errors with streaming replication in 9.4.1