Проблемы регистра с названиями таблиц, полей

parus
Дата: 29.04.2004 13:20:12
После конвертации БД в pg возникли проблемы: запросы выполняются только для таблиц и полей с названиями в нижнем регистре. Это ограничение pg или где-то есть какая-то настройка?
Заглянул
Дата: 29.04.2004 13:53:44

test=# create table "test_quoted" ("test_ID" integer, "test_Name" varchar(20));
CREATE TABLE
test=# select test_id from test_quoted;
ERROR: Attribute "test_id" not found
test=# select test_ID from test_quoted;
ERROR: Attribute "test_id" not found
test=# select "test_ID" from test_quoted;
test_ID
---------

(0 rows)

test=# select "test_ID" from "Test_quoted";
ERROR: Relation "Test_quoted" does not exist



См. Chapter 4. SQL Syntax подраздел 4.1. Lexical Structure документации.
PostgreSQL Documentation


Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other. [1]

Notes
[1] The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.

Заглянул
Дата: 29.04.2004 13:57:46
Да, еще забыл.

test=# \d test_quoted
Table "public.test_quoted"
Column | Type | Modifiers
-----------+-----------------------+-----------

test_ID | integer |
test_Name | character varying(20) |



Мы видим, что имена столбцов квотировались при создании.