PostgreSQL Developer Best Practices

Started by Marc Munroover 10 years ago12 messagesgeneral
Jump to latest
#1Marc Munro
marc.munro@gmail.com

On Sat, 2015-08-22 at 15:15 +0000, Melvin Davidson wrote:

I've been searching for a "PostgreSQL Developer Best Practices" with not
much luck,
so I've started my own. At the risk of stirring up a storm of controversy,
I would appreciate additional suggestions and feedback.

You might add: Create all relation names as plurals.

Or, if your site uses predominantly singular names, make that the
standard. Consistency within the site is more important than any
dogmatic belief about whether singular or plural forms is better. If
you don't put it in the standard, someone will eventually create tables
with names that don't gel with everything else.

__
Marc

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Melvin Davidson
melvin6925@gmail.com
In reply to: Marc Munro (#1)
Re: PostgreSQL Developer Best Practices

Consistency in naming convention.

Good suggestion!

On Tue, Aug 25, 2015 at 12:33 PM, Marc Munro <marc.munro@gmail.com> wrote:

On Sat, 2015-08-22 at 15:15 +0000, Melvin Davidson wrote:

I've been searching for a "PostgreSQL Developer Best Practices" with not
much luck,
so I've started my own. At the risk of stirring up a storm of

controversy,

I would appreciate additional suggestions and feedback.

You might add: Create all relation names as plurals.

Or, if your site uses predominantly singular names, make that the
standard. Consistency within the site is more important than any
dogmatic belief about whether singular or plural forms is better. If
you don't put it in the standard, someone will eventually create tables
with names that don't gel with everything else.

__
Marc

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

#3Gavin Flower
GavinFlower@archidevsys.co.nz
In reply to: Marc Munro (#1)
Re: PostgreSQL Developer Best Practices

On 26/08/15 04:33, Marc Munro wrote:

On Sat, 2015-08-22 at 15:15 +0000, Melvin Davidson wrote:

I've been searching for a "PostgreSQL Developer Best Practices" with not
much luck,
so I've started my own. At the risk of stirring up a storm of controversy,
I would appreciate additional suggestions and feedback.

You might add: Create all relation names as plurals.

Or, if your site uses predominantly singular names, make that the
standard. Consistency within the site is more important than any
dogmatic belief about whether singular or plural forms is better. If
you don't put it in the standard, someone will eventually create tables
with names that don't gel with everything else.

__
Marc

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Cheers,
Gavin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Rob Sargent
robjsargent@gmail.com
In reply to: Gavin Flower (#3)
Re: PostgreSQL Developer Best Practices

On 08/25/2015 04:27 PM, Gavin Flower wrote:

On 26/08/15 04:33, Marc Munro wrote:

On Sat, 2015-08-22 at 15:15 +0000, Melvin Davidson wrote:

I've been searching for a "PostgreSQL Developer Best Practices" with
not
much luck,
so I've started my own. At the risk of stirring up a storm of
controversy,
I would appreciate additional suggestions and feedback.

You might add: Create all relation names as plurals.

Or, if your site uses predominantly singular names, make that the
standard. Consistency within the site is more important than any
dogmatic belief about whether singular or plural forms is better. If
you don't put it in the standard, someone will eventually create tables
with names that don't gel with everything else.

__
Marc

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

4. Each tuple is an instance of entity, not entities :)

Cheers,
Gavin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: Gavin Flower (#3)
Re: PostgreSQL Developer Best Practices

On Tue, Aug 25, 2015 at 6:27 PM, Gavin Flower <GavinFlower@archidevsys.co.nz

wrote:

On 26/08/15 04:33, Marc Munro wrote:

On Sat, 2015-08-22 at 15:15 +0000, Melvin Davidson wrote:

I've been searching for a "PostgreSQL Developer Best Practices" with not

much luck,
so I've started my own. At the risk of stirring up a storm of
controversy,
I would appreciate additional suggestions and feedback.

You might add: Create all relation names as plurals.

Or, if your site uses predominantly singular names, make that the
standard. Consistency within the site is more important than any
dogmatic belief about whether singular or plural forms is better. If
you don't put it in the standard, someone will eventually create tables
with names that don't gel with everything else.

__
Marc

Actually I would suggest standardising on singular names, not JUST

because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Because my first college IS professor taught it this​

​way...I do like these other reasons though.

The fact that a table can have multiple rows is pretty much a given - and I
wouldn't suggest plural adherents name any singleton tables using the
singular form - so no information is lost. Having since learned OO the
class of something is labelled in the singular form and in many ways a
relation definition is equivalent to a class definition.

​David J.​

#6Vincent de Phily
vincent.dephily@mobile-devices.fr
In reply to: Gavin Flower (#3)
Re: PostgreSQL Developer Best Practices

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

--
Vincent de Phily

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7John McKown
john.archie.mckown@gmail.com
In reply to: Vincent de Phily (#6)
Re: PostgreSQL Developer Best Practices

On Wed, Aug 26, 2015 at 7:03 AM, Vincent de Phily <
vincent.dephily@mobile-devices.fr> wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

​OTOH, either is better than some insane DBA who calls them "TableOf????"
(camel case in quotes to preserve case)​ to be "self documenting and easy
to read" (Likely a COBOL programmer in a former life). Oh, and then "to
make it simple", all the SQL uses the AS to "alias" the table name to a
single alphabetic character in [a-z].

--
Vincent de Phily

--

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

#8Gavin Flower
GavinFlower@archidevsys.co.nz
In reply to: Vincent de Phily (#6)
Re: PostgreSQL Developer Best Practices

On 27/08/15 00:03, Vincent de Phily wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

???

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In reply to: Gavin Flower (#8)
Re: PostgreSQL Developer Best Practices

On 26/08/2015 19:54, Gavin Flower wrote:

On 27/08/15 00:03, Vincent de Phily wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

???

A school of fish and a murder of crows... wonderfully evocative
collective nouns.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#10George Weaver
gweaver@shaw.ca
In reply to: Marc Munro (#1)
Re: PostgreSQL Developer Best Practices

----- Original Message -----
From: Gavin Flower

On 27/08/15 00:03, Vincent de Phily wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

???

Dish - Dishes
Fish - School

Bow - Bows
Crow - Murder

Goose - Geese
Moose - Moose

House - Houses
Mouse - Mice

and so on...

Cheers,
George

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#11Gavin Flower
GavinFlower@archidevsys.co.nz
In reply to: Raymond O'Donnell (#9)
Re: PostgreSQL Developer Best Practices

On 27/08/15 06:59, Raymond O'Donnell wrote:

On 26/08/2015 19:54, Gavin Flower wrote:

On 27/08/15 00:03, Vincent de Phily wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

???

A school of fish and a murder of crows... wonderfully evocative
collective nouns.

Ray.

Hmm...

Reminds me about a story I was told where a programmer had used names of
his favourite footballers as labels in an assembler program! :-)

-Gavin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#12Melvin Davidson
melvin6925@gmail.com
In reply to: Gavin Flower (#11)
Re: PostgreSQL Developer Best Practices

Thank you to all that contributed to this thread. I now have about a dozen
guidelines
I would like to share. However, since a few individuals felt it was more of
an
opportunity to prove or disprove certain theories, rather than just
contribute additional
good practices, I will not be posting them directly to this thread. Rather,
if anyone is
interested in obtaining a copy, please just send me a request to my direct
email and I
will gladly reply back with a copy.

Know that these are general guidelines. If you disagree with any of them,
then you
are free to change them to suit you specific requirements. Just please do
not start
another thread to debate the merits or disadvantages of them. If it's more
important
to prove that you are right rather than contribute to help others, then you
are doing
neither.

On Wed, Aug 26, 2015 at 3:13 PM, Gavin Flower <GavinFlower@archidevsys.co.nz

wrote:

On 27/08/15 06:59, Raymond O'Donnell wrote:

On 26/08/2015 19:54, Gavin Flower wrote:

On 27/08/15 00:03, Vincent de Phily wrote:

On Wednesday 26 August 2015 10:27:04 Gavin Flower wrote:

Actually I would suggest standardising on singular names, not JUST
because that this the standard I prefer! :-)

But (also) because:

1. Singular words tend to be shorter

2. plurals are more ambiguous wrt spelling

3. there other good reasons, that I've forgotten for now :-(
(but I remember having them!!!)

Oh, so you name your tables 'fish' and 'crow' instead of 'school' and
'murder' ? Such wasted opportunities :p

???

A school of fish and a murder of crows... wonderfully evocative
collective nouns.

Ray.

Hmm...

Reminds me about a story I was told where a programmer had used names of
his favourite footballers as labels in an assembler program! :-)

-Gavin

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.