Re: Quotation marks in queries

From: Russ Brown <pickscrape(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Quotation marks in queries
Date: 2005-07-14 17:36:38
Message-ID: 42D6A2A6.5020307@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tony Caduto wrote:
> The easiest solution is just not to use caps or spaces in your
> table/object names, there is no advantage to doing so.
> People just need to get over the fact that having caps in a name make it
> easier to read.
>
> My Test Table should be my_test_table, the naming makes no difference
> to the application using the table.
>

I agree about the spacing part (though others wouldn't and who am I to
tell them what to think?), but from a personal point of view I vastly
prefer camel caps to underscores in all situations. It's a pain for me
to have to use lower case + underscores in the database when the rest of
my code uses camel caps. It's also a pain to have to quote all
identifiers to be able to use camel caps. Providing a config option to
silently quote all identifiers submitted would solve the problem without
having any effect on those who like the underscore style.

> Same thing with ordering of fields in a table, it makes no difference
> other than for looks if the fields are in the order you want them
> to be in.
>

Agreed, but having the fields ordered logically can be a form of
self-documentation. i.e. having the PK always at the start, grouping
closely-related fields together etc. The application using the table
should definitely not depends on field ordering though.

> It is much more of a pain to qoute your sql than it is to have it look
> nice.
>

Absolutely! That's why I was wondering about a configuration option to
make pg automatically quote all identifiers.

> Just my 2 cents on the subject.
>
> Tony
>
> Relyea, Mike wrote:
>
>> You only need to use quotes in your SQL statements if your table names
>> in PostgreSQL contain any upper case letters. PostgreSQL automatically
>> converts all of your SQL statements to lower case unless they're quoted.
>>
>> As an alternative to quoting in VB (assuming you're using Access as your
>> FE), store your SQL in tables where you can quote it correctly instead
>> of having to use " & chr(34) & " or """" every time you want to insert a
>> quote in VB.
>>
>> Mike
>>
>>
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-07-14 17:51:12 Re: ERROR: could not open relation
Previous Message Tom Lane 2005-07-14 17:18:44 Re: strange error with temp table: pg_type_typname_nsp_index