Thread: naming convention/mixed case

naming convention/mixed case

From
Alejandro Fernandez
Date:
Hi

I'm working on a project (http://mandible.sourceforge.net/)that uses
postgres for a membership directory. The database being used as a
starting example is currently an Access database, and the first naming
standard I'm using is the Leszynski/Reddick one at
http://msdn.microsoft.com/library/backgrnd/html/msdn_20naming.htm
- especially since these are the conventions that are currently used in
the access database.

The problem is that postgres's handling of mixed case table names etc
makes things quite complicated, as they have to be enclosed in double
quotes: this makes tab completion useless in psql, and possibly
complicates functions/triggers/etc, as they will need mixtures of double
and single quotes. For example, creating sequences called "seqMemberId"
made them hard to modify with nextval and setval, as the function uses
single quotes already.

For me, it's fine to just live with this, as I've started using that
convention, but just for future reference, is there a naming standard
that is better indicated for postgresql(and other unix friendly
databases perhaps?), or is there a plan to get postgres naming to
support mixed case more?

Thanks,

Ale
--
Alejandro Fernandez Bscp 5 Caledonian University
0141 586 3913 - ale@nin.cx

Re: naming convention/mixed case

From
Tom Lane
Date:
Alejandro Fernandez <ale@nin.cx> writes:
> The problem is that postgres's handling of mixed case table names etc
> makes things quite complicated, as they have to be enclosed in double
> quotes:

Only if you insist on them appearing in mixed case in the database.
Have you thought about writing myFieldName in your queries, and ignoring
the fact that the database will smash it down to myfieldname?

> or is there a plan to get postgres naming to
> support mixed case more?

Doing so would make us less compliant with the SQL standard, so no,
there aren't any plans to change that.

            regards, tom lane

Re: naming convention/mixed case

From
Alejandro Fernandez
Date:
Tom Lane wrote:
> > or is there a plan to get postgres naming to
> > support mixed case more?
>
> Doing so would make us less compliant with the SQL standard, so no,
> there aren't any plans to change that.
>
>

I suspected that the access guidelines broke the SQL standard! Thanks
for the information. Is there a standards compliant naming convention I
can use as an alternative in future?

Thanks,

Ale
--
Alejandro Fernandez Bscp 5 Caledonian University
0790 541 8809 - ale@nin.cx

Re: Re: naming convention/mixed case

From
Tom Lane
Date:
Alejandro Fernandez <ale@nin.cx> writes:
> I suspected that the access guidelines broke the SQL standard! Thanks
> for the information. Is there a standards compliant naming convention I
> can use as an alternative in future?

You can use mixed case if you want --- you just have to be absolutely
consistent about whether you double-quote the names or not.

        FooBar  is the same as        foobar
        FooBar  is NOT the same as    "FooBar"

You can write 'em with quotes if you want, or without if you want,
but you have to do it the same way all the time.

            regards, tom lane

Re: Re: naming convention/mixed case

From
will trillich
Date:
On Tue, May 15, 2001 at 10:05:02AM -0400, Tom Lane wrote:
> Alejandro Fernandez <ale@nin.cx> writes:
> > I suspected that the access guidelines broke the SQL standard! Thanks
> > for the information. Is there a standards compliant naming convention I
> > can use as an alternative in future?
>
> You can use mixed case if you want --- you just have to be absolutely
> consistent about whether you double-quote the names or not.
>
>         FooBar  is the same as        foobar
>         FooBar  is NOT the same as    "FooBar"
>
> You can write 'em with quotes if you want, or without if you want,
> but you have to do it the same way all the time.

but how about

    "something"  might be the same as  something

where both are all lowercase...?

--
What do I need manners for? I already got me a wife.
    -- Adam Pontipee, "Seven Brides for Seven Brothers"

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!