[GENERAL] Error in column constraint syntax

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема [GENERAL] Error in column constraint syntax
Дата
Msg-id alpine.LNX.2.11.1612270830260.8904@localhost
обсуждение исходный текст
Ответы Re: [GENERAL] Error in column constraint syntax
Список pgsql-general
   I'm encountering DDL syntax errors using postgres-9.6.1 that I've not
before seen, and I'm having a difficult time finding the cause when reading
the appropriate sections of the manual; Section 5.3.1 in this case:

CREATE TABLE Agencies (
   org_name VARCHAR(48) PRIMARY KEY,
   acronym VARCHAR(8) DEFAULT ' ',
   org_lvl VARCHAR(8) DEFAULT 'State'
      CONSTRAINT invalid_agency_level
      CHECK org_lvl IN ('Federal', 'State', 'County', 'City', 'Local', 'Regional'),
   website VARCHAR(64) DEFAULT ' ',
   created_at TIMESTAMP,
   created_by TEXT NOT NULL,
   updated_at TIMESTAMP,
   updated_by TEXT NOT NULL,
   comment TEXT
);

   psql reports:

:86: ERROR:  syntax error at or near "org_lvl"
LINE 6:      CHECK org_lvl IN ('Federal', 'State', 'County', 'City',...
                    ^
   Having a default value or a named constraint makes no difference, and the
maximum size of the org_lvl column is that of the longest string so I am not
seeing the source of my error.

   Where, other than Section 5.3.1 of the manual can I learn why there's an
error?

   I also have several errors of 'table not found' yet to be understood and resolved
but this one is at the top of the file.

TIA,

Rich


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] Windows installation - could not connect to server:Connection refused (0x0000274D/10061)
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] Error in column constraint syntax