Re: how to rename an unnamed uniqueness constraint?

Поиск
Список
Период
Сортировка
Искать
От
Oliver Elphick
Тема
Re: how to rename an unnamed uniqueness constraint?
Дата
Msg-id
1124230602.12095.99.camel@linda
Ответ на
Список
Дерево обсуждения
how to rename an unnamed uniqueness constraint? Oliver Kullmann <O.Kullmann@swansea.ac.uk>
Re: how to rename an unnamed uniqueness constraint? Oliver Elphick <olly@lfix.co.uk>
Re: how to rename an unnamed uniqueness constraint? Oliver Kullmann <O.Kullmann@swansea.ac.uk>
Re: how to rename an unnamed uniqueness constraint? Oliver Elphick <olly@lfix.co.uk>
On Tue, 2005-08-16 at 19:01 +0100, Oliver Kullmann wrote:
> I have a table created with
> 
> CREATE TABLE Current_academic_year
> (
> 	year_id		INT	REFERENCES Academic_years,
> 	CONSTRAINT year_id CHECK(year_id IS NOT NULL),
> 	active		BOOL	NOT NULL,
> 
> 	UNIQUE(year_id),
> 	UNIQUE(active)
> )
> ;

Since this is the novice list, I will add that that is a round-about way
of declaring the table.

CREATE TABLE current_academic_year
(
	year_id		INT 	PRIMARY KEY REFERENCES academic_years,
	active		BOOLEAN	NOT NULL UNIQUE
);
does the same and is easier to read.

Also, your capitalisation of table names won't be preserved, because you
don't double-quote them.

-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html

В списке pgsql-novice по дате отправления
От: Oliver Elphick
Дата:
От: Leif K-Brooks
Дата:
Сообщение: Modifiable sequence column?
FAQ