[SQL] What are the (various) best practices/opinions for table/column/constraint naming?

2008-02-08 Thread Ken Johanson
I'd like to see a list o t he various approaches, and a poll as to which are best and why, for naming table and columns and constraints. We've all seen several variations, but the most common (and pg used) seems to be: columns: primary key: _pk OR _id OR _rowid foreign key: _fk OR _join indexe

Re: [SQL] Postgres roles

2008-02-08 Thread Pascal Tufenkji
Hi Shane, You are exactly right. My issue is that, I now have one role called sti - that has carried the group members from the old version - So what do you think my options are, so I can separate them? I have only one option in my mind: - Revoke the members from the role sti -

Re: [SQL] Postgres roles

2008-02-08 Thread Shane Ambler
Pascal Tufenkji wrote: My questions are: 1. how do I identify the users assigned to this role : (in the older version) SELECT grolist from pg_group where groname = 'sti'; "The view pg_group exists for backwards compatibility: it emulates a catalog that existed in PostgreSQL before

Re: [SQL] Serial not nulla

2008-02-08 Thread Shane Ambler
Shavonne Marietta Wijesinghe wrote: Hello I am working with a database that has a Index number defined as Serial NOT NULL I used this because, 1. I want to make sure that when many users login at the same time the Index number won't be repeated. 2. I don't have to increment it by programming (

[SQL] Postgres roles

2008-02-08 Thread Pascal Tufenkji
Hi, I'd like to ask you a question about users, groups and roles. In older versions of Postgres we had users and groups as two separate entities Our IT department at work is called "sti", that's why: - I had a user "sti" (the username of our IT manager) - I had a group "sti"

[SQL] Serial not nulla

2008-02-08 Thread Shavonne Marietta Wijesinghe
Hello I am working with a database that has a Index number defined as Serial NOT NULL I used this because, 1. I want to make sure that when many users login at the same time the Index number won't be repeated. 2. I don't have to increment it by programming (I use ASP) But now i have a situation

[SQL] performance issue - view and derived field

2008-02-08 Thread Gary Stainburn
Hi folks. I have a view used_diary_details shown below. If I do a basic search on one of the fields of the underlying table the select takes under 1/2 second. If I do a search using the derived field it takes over 15 seconds. Anyone know how I can improve this as it's killing my app. -- Takes