BUG #18619: uppercase column with quotation marks, gets an error without quotation marks

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #18619: uppercase column with quotation marks, gets an error without quotation marks
Дата
Msg-id 18619-fc593e84ad9763fb@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #18619: uppercase column with quotation marks, gets an error without quotation marks
Re: BUG #18619: uppercase column with quotation marks, gets an error without quotation marks
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18619
Logged by:          Kirill N
Email address:      gcso@sqliteonline.com
PostgreSQL version: 17rc1
Operating system:   docker 17rc1
Description:

Hello, 

If you create a table with field names in uppercase and put them in
quotation marks.
then such fields can be accessed only with quotation marks. 

postgres=# create table a ("b" int, "C" int);
CREATE TABLE
postgres=# select b from a;
 b 
---
(0 rows)

postgres=# select c from a;
ERROR:  column "c" does not exist
LINE 1: select c from a;
               ^
postgres=# select C from a;
ERROR:  column "c" does not exist
LINE 1: select C from a;
               ^
postgres=# select "c" from a;
ERROR:  column "c" does not exist
LINE 1: select "c" from a;
               ^
postgres=# select "C" from a;
 C 
---
(0 rows)



The table structure is returned without quotation marks

postgres=# SELECT 
    t.table_schema,
    t.table_name,
    c.column_name,
    c.data_type
FROM 
    information_schema.tables t
JOIN 
    information_schema.columns c
ON 
    t.table_schema = c.table_schema
    AND t.table_name = c.table_name
WHERE 
    t.table_type = 'BASE TABLE'
    AND t.table_schema NOT IN ('information_schema', 'pg_catalog')  --
Исключаем системные схемы
ORDER BY 
    t.table_schema,
    t.table_name,
    c.ordinal_position;
 table_schema | table_name |  column_name  |     data_type     
--------------+------------+---------------+-------------------
 public       | a          | b             | integer
 public       | a          | C             | integer


В списке pgsql-bugs по дате отправления: