Re: ID column naming convention - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: ID column naming convention
Date
Msg-id 20151016065632.GA3037@hermes.hilbert.loc
Whole thread Raw
In response to Re: ID column naming convention  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
List 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 by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: question
Next
From: Francisco Olarte
Date:
Subject: Re: question