On 11/8/06, novnov <novnovice@xxxxxxxxx> wrote:
I'm new to pgsql, mostly coming from MSSQL. It sounds like it's simplest to keep field names lowercase with pgsql, so I will have to change some habits I've developed over the years. I would like to glean whatever collective wisdom I can here from experienced pgsql devs. I've been using namestyles with mixed case like OrgID. That is much more readable than orgid. Probably a good convention to adopt would be to use namestyles like org_id. That change I can live with.
of course, it's all in the eye of the beholder, but i think org_id looks much better than OrgID. I suggest not prefixing tables with 'tbl', but idx_ for indexes and fk_ for foreign keys is ok. I also think its ok to do on_xyx_delete for a delete trigger on table xyz. some people like to name id columns 'id' and refer to that column as xyz_id for foreign key reference, but I prefer to write out xyz_id in all tables...it helps with natural joins and searching. this is basically your argument as well. also, and this is getting into flamewar territory, but i prefer to not pluralize tables (create table order) for conceptual reasons. no big deal though really. my tables do not automatically get an 'id' column although they often do...this is barely on topic for your post so ill leave it there ;-) one last thing (also not really on topic), and this is very much against the grain, but I do not do upper/lower case mixture that I see in 95% of the sql on the web: SELECT * FROM order WHERE it reminds me too much of cobol, er COBOL and it makes my brain hurt. i also passively agressively affirm my minority stand on this issue by deliberately having lousy capitalization on the various lists. regards, merlin