Re: [SQL] Referential integrity: broken rule?

2000-10-11 Thread Stephan Szabo
Yes, I believe it is mentioned in the docs (well at least the sgml source, I don't have a compiled doc set) as a bug of the implementation somewhere in the section on references. 7.1 should fail for this case, although it doesn't properly deal with dropping the unique constraint later. Stephan

[SQL] Referential integrity: broken rule?

2000-10-11 Thread Franz J Fortuny
This table: create table things ( idthing integer not null, isthis boolean not null primary key(idthing,isthis) ) would be referenced by this one: create table forthings ( fromthing integer not null references things(idthing), ) The above SHOULD NOT be accepted, since tabl

Re: [SQL] SQL to retrieve foreign keys

2000-10-11 Thread Stephan Szabo
Actually, right now it isn't trivial with the implementation. You need to decode things out of the arguments to triggers which are in a bytea and there aren't alot of reasonable sql level stuff to decode it. If you don't mind doing some of the work on the front end, you should be able do it. If

[SQL] SQL to retrieve foreign keys

2000-10-11 Thread Colleen Williams
Hi, I would like to write some SQL to extend the phpPgAdmin tool where it only displays primary keys related to a table. I have looked at the programmers doco and searched the discussions on foreign keys but was not able to decipher how to write the SQL. It is probably really trivial for someo

[SQL] AFTER triggers, short question

2000-10-11 Thread Mark Volpe
If I create a trigger that runs AFTER a DELETE, and then I delete several rows, will the trigger function see the same thing every time it's called, namely that all the rows I deleted are actually gone? Mark

Re: [SQL] Can I use subselect as a function parameter?

2000-10-11 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: > The short answer is that subselect in CHECK is not currently supported, and > is not planned for 7.1. We should, however, try to make 7.1 deliver a more helpful error message ;-). I've put a note about it on my todo list. regar

Re: [SQL] Can I use subselect as a function parameter?

2000-10-11 Thread Philip Warner
At 14:42 11/10/00 +0100, Oliver Elphick wrote: > > CONSTRAINT ean CHECK ( > CASE WHEN eancode IS NULL OR brand IS NULL > THEN 't' > ELSE ean_checkdigit( > (SELECT ean_prefix > FROM brandname, product > WHERE brandname.

[SQL] Can I use subselect as a function parameter?

2000-10-11 Thread Oliver Elphick
I want to do this: CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS BOOLEAN AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'C'; CREATE TABLE product ( id CHAR(10) PRIMARY KEY, brandCHAR(12) REFERENCES brandname(id)