[Pdx-pm] (OT) SQL style question

David Wheeler david at kineticode.com
Thu Jan 13 17:07:30 PST 2005


On Jan 13, 2005, at 4:50 PM, Kevin Long wrote:

> I had the luxury of creating a system for a large but known set of
> databases and tables. Additionally addition of new databases and tables
> that users were not interested in reporting on were not needed.
>
> You must admit that _CONTAINS_ is an unlikely name-part for a table =-)

Yes, but it's not very distinctive, visually. And in a view where you  
might have a bunch of them, it can get to be pretty ridiculous:

  select * from foo;
  id | name | bar_contains_id | bar_contains_name |  
bar_contains_description | bar_contains_status | bar_contains_long_name
----+------+-----------------+------------------- 
+--------------------------+--------------------- 
+------------------------

Ick. Note that the case sensitivity wasn't retained because I didn't  
use double-quotes to create this table.

Note that you can also run into problems when the maximum number of  
characters you can use in column names is limited to a low number (as  
it was in PostgreSQL 7.2 or 7.3, when it was 32 characters!).

I much prefer __:

select * from foo;
  id | name | bar__id | bar__name | bar_description | bar__status |  
bar__long_name
----+------+---------+-----------+-----------------+------------- 
+----------------

And me being a Perler, I don't mind using punctuation characters to add  
meaning.

This is what we're going to do; thanks to everyone for the feedback!

Regards,

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20050113/60494cab/smime.bin


More information about the Pdx-pm-list mailing list