| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | gcso(at)sqliteonline(dot)com | 
| Subject: | BUG #18619: uppercase column with quotation marks, gets an error without quotation marks | 
| Date: | 2024-09-16 07:29:54 | 
| Message-ID: | 18619-fc593e84ad9763fb@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      18619
Logged by:          Kirill N
Email address:      gcso(at)sqliteonline(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Francisco Olarte | 2024-09-16 08:41:02 | Re: BUG #18619: uppercase column with quotation marks, gets an error without quotation marks | 
| Previous Message | PG Bug reporting form | 2024-09-15 22:17:33 | BUG #18618: pg_upgrade from 14 to 15+ fails for unlogged table with identity column |