Re: PK with an expression in field list

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PK with an expression in field list
Дата
Msg-id 1070.1148499886@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PK with an expression in field list  ("Alejandro Michelin Salomon \( Adinet \)" <alejmsg@adinet.com.uy>)
Ответы RES: PK with an expression in field list  ("Alejandro Michelin Salomon \( Adinet \)" <alejmsg@adinet.com.uy>)
Список pgsql-general
"Alejandro Michelin Salomon \( Adinet \)" <alejmsg@adinet.com.uy> writes:
> I need create a PK for a table.
> This PK has 3 fields.
> PK is : CONSTRAINT ff_navios PRIMARY KEY ( idempresa, idarmador, UPPER( nome
> ) )
> But seems not work.

You can't define a primary key on an expression.  The SQL standard says
so, and even if we wanted to generalize the standard here, we'd have a
bit of a problem with how it'd show up in the information_schema.

You can, however, create a unique index over those values and get pretty
much the same effect.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: meaning of PQresultStatus types
Следующее
От: Michael Ben-Nes
Дата:
Сообщение: I dont get it, dump / restore failures to the same cluster.