Re: ID column naming convention

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: ID column naming convention
Дата
Msg-id 20151016065632.GA3037@hermes.hilbert.loc
обсуждение исходный текст
Ответ на Re: ID column naming convention  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Список pgsql-general
On Fri, Oct 16, 2015 at 02:28:25PM +1300, Gavin Flower wrote:

> Since 'id' is only used to indicate a PRIMARY KEY, there is less confusion
> in joins, and it is clear when something is a foreign key rather than a
> PRIMARY KEY.

Given that "id" often has meaning outside the database I much
prefer naming my primary keys "pk". And foreign keys "fk_TABLENAME":

    line_item.pk_stock = stock.pk

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


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

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: question
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: question