Re: [SQL] Table Constraints with NULL values

2001-10-19 Thread Tom Lane
"David Allardyce" <[EMAIL PROTECTED]> writes: > ... If they had defined uniqueness as "all rows > must be distinct" then two all null rows would violate the uniqueness > constraint. Not the behavior I want at all. Er, why not? You're essentially arguing that the UNIQUE constraint should treat n

Re: [SQL] Table Constraints with NULL values

2001-10-19 Thread David Allardyce
I don't mean to re-hash an argument that has been debated-to-death before, but I can't help myself... > > However, shouldn't any values that are not NULL violate the constraint if > > the same values exist already? > > No. Postgres is conforming to the SQL standard in this. SQL92 saith > in sec

Re: [SQL] oid's in views.

2001-10-19 Thread Josh Berkus
Aasmund, > I don't use them in indexes foreign keys etc., however they are very > usefull when your application tries to edit/update individual rows, > as the oid is like a universal primary key. You'd still be better off defining your own SERIAL columns and/or primary keys and using those. Som

Re: [SQL] system maintained keys

2001-10-19 Thread Jason Earl
Check out the SERIAL type. It does precisely what you want. An idea as to how this is used would be like this: CREATE TABLE foo ( prim_key SERIAL PRIMARY KEY, bar text ); I tend to create sequences by hand like this: CREATE SEQUENCE my_sequence_seq; And then I create my tabl

Re: [SQL] Diferent databases on same query...

2001-10-19 Thread Andre Schnabel
"Douglas Rafael da Silva" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I'd like to do a query where can be possible I access tables from > diferent databases on the same query. > On MySQL, I do: > > SELECT People1.PersID, People1.Name, Result1.

Re: [SQL] system maintained keys

2001-10-19 Thread Joel Burton
On Mon, 15 Oct 2001, Stefan Lindner wrote: > Is there any way to get system maintained keys from postgres? e.g. to > have a table with a primary key column (varchar or int) and let postgres > chose the next unique value for this column? \h CREATE SEQUENCE will give syntax, or look up SEQUENCES

Re: [SQL] oid's in views.

2001-10-19 Thread Aasmund Midttun Godal
On Fri, 19 Oct 2001 08:07:50 -0700, "Josh Berkus" <[EMAIL PROTECTED]> wrote: > Aasmund, > > > I believe the *official* reccommendation now is that you leave the OIDs > to the system, and create your own SERIAL values for row identification. > There are *lots* of problems with using OIDs as an in

Re: [SQL] system maintained keys

2001-10-19 Thread Josh Berkus
Stefan, > Is there any way to get system maintained keys from postgres? e.g. to > have a table with a primary key column (varchar or int) and let > postgres > chose the next unique value for this column? Please address future questions of this type to the PGSQL-NOVICE list. PGSQL-SQL is for more

[SQL] system maintained keys

2001-10-19 Thread Stefan Lindner
Is there any way to get system maintained keys from postgres? e.g. to have a table with a primary key column (varchar or int) and let postgres chose the next unique value for this column? ---(end of broadcast)--- TIP 6: Have you searched our list

[SQL] Diferent databases on same query...

2001-10-19 Thread Douglas Rafael da Silva
Hi, I'd like to do a query where can be possible I access tables from diferent databases on the same query. On MySQL, I do: SELECT People1.PersID, People1.Name, Result1.Value, Result1.Date FROM Database1.People1, Database2.Result1 WHERE ... I think on ORACLE works like as: SELECT People1.PersI

Re: [SQL] oid's in views.

2001-10-19 Thread Josh Berkus
Aasmund, > The oid column will always be blank. The oid column can never be used > for anything usefull. I believe the *official* reccommendation now is that you leave the OIDs to the system, and create your own SERIAL values for row identification. There are *lots* of problems with using OIDs a

[SQL] Privileges on Functions in Postgres 7.1.3

2001-10-19 Thread Sushil Kumar
Hi, Is it possible to allow a user to execute a procedure that will update some tables without the user having any privileges on the underlying tables themselves (like in Oracle where the procedure effectively runs with the privilege of the creator)? Regards, ___

[SQL] Can't postgres join tables on varchar fields ?

2001-10-19 Thread Gurudutt
Hi!!, -- Best regards, Gurudutt mailto:[EMAIL PROTECTED] Life is not fair - get used to it. Bill Gates ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Need a VIEW without SUB-SELECT

2001-10-19 Thread Aasmund Midttun Godal
CREATE VIEW status_schmetus AS SELECT approval.status_name AS aproval_status_name, acknowledgement.status_name AS acknowledgement_status_name FROM po_status JOIN status AS approval ON(po_status.approval_status_id = status.status_id) JOIN status AS acknowledgement ON(po_status.acknowledgement_st

Re: [SQL] Table Constraints with NULL values

2001-10-19 Thread Tom Lane
"David Allardyce" <[EMAIL PROTECTED]> writes: > However, shouldn't any values that are not NULL violate the constraint if > the same values exist already? No. Postgres is conforming to the SQL standard in this. SQL92 saith in section 4.10: A unique constraint is satisfied if and only

[SQL] Need a VIEW without SUB-SELECT

2001-10-19 Thread Bhuvan A
Hi all, Kindly apologize any inconvenience! I have 2 tables status and po_status like.. CREATE TABLE status ( status_id int primary key, status_name varchar(15) ); CREATE TABLE po_status ( po_no varchar(15), approval_status_id int references status(status