Re: Table and Field namestyle best practices? - Mailing list pgsql-general

From novnov
Subject Re: Table and Field namestyle best practices?
Date
Msg-id 7308343.post@talk.nabble.com
Whole thread Raw
In response to Re: Table and Field namestyle best practices?  ("Dawid Kuroczko" <qnex42@gmail.com>)
Responses Re: Table and Field namestyle best practices?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Table and Field namestyle best practices?  (Scott Ribe <scott_ribe@killerbytes.com>)
List pgsql-general
OK, thanks. I'm having a major internal debate about how I'm going to adjust
my habits to pgsql's 'lowercase is simplest' reality, all of this is
helpful.

One thing I've not been able to determine is if there are any characters
besides the standard alphanumeric ones and "_" that do not invoke the double
quoting of names. Are there any? If there were others, it'd be nice to know,
for possible use as namespace markers ("_" is most commonly used for this,
maybe it's the only real candidate).


Dawid Kuroczko wrote:
>
> On 11/8/06, novnov <novnovice@gmail.com> wrote:
>> I am very curious to hear the various conventions folks here have arrived
>> at. I don't expect there to be consensus, but the various rationales
>> might
>> help me arrive at an approach that works well for me.
>
> Personally I use all lower caps names a typical table might look:
>
> CREATE TABLE names (
>    name_id serial PRIMARY KEY,
>    name varchar(100) UNIQUE NOT NULL,
>    birth date
> );
> CREATE INDEX names_birth_index ON names (birth)
> CREATE INDEX names_name_lower_index ON names (lower(name));
> CREATE TABLE winners (
>   winner_id serial PRIMARY KEY,
>   name_id integer REFERENCES names
> );
> CREATE VIEW winner_names_view AS
>   SELECT * FROM winners JOIN names USING (name_id);
>
> ...generally I don't like naming columns like 'id' -- if I put
> full names, like name_id then JOIN ... USING(col_id) or
> NATURAL JOINs are easy and straightforward.
>
> Sometimes I put a trailing "_view" to mark that given table
> is really a view.  My index names are composed of
> table_col1_col2_index or  table_col1_function_index
> (like the above lower() case).  If index is unique,
> I use "_key" as a suffix instead of "_index".
>
> I know couple of people who name their tables like
> T_Name, T_Winner etc. (and V_For_Views), but I consider
> it a bit superfluous for my tastes.  And if I have whole a lot
> tables, I like to keep them organized into schemas, which
> are powerful beings in PostgreSQL.
>
>    Regards,
>        Dawid
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>
>

--
View this message in context: http://www.nabble.com/Table-and-Field-namestyle-best-practices--tf2596761.html#a7308343
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: Why overlaps is not working
Next
From: "Schwenker, Stephen"
Date:
Subject: Re: DELETE performance issues