Thread:
I have a reference which is guaranteed not to have a valid reference (preferably NULL) until it is processed later. How can I defer a reference entry so that both NULL and an actual reference are valid in the reference field? The processing which I speak of takes place later and not in the same transaction (thus making DEFERRABLE useless, right?). A solution I thought of is to forget keys and just make it an INT8 since I am also guaranteed that its referenced item is never deleted. But certainly, there is a more reliable way to do it, right?In summary, what I want is field INT8 REFERENCES sometable NULL OK or field INT8 CHECK(SELECT id FROM someothertable WHERE field=id) (can I do this? this allows NULL right?) The rule is ref2 can either be a valid reference or NULL. CREATE TABLE thetable(ref2 INT8 REFERENCES someothertable,... ); Thanks for any help.><><><><><><><><>< AgentM agentm@cmu.edu
"A.M." <agentm@cmu.edu> writes: > In summary, what I want is > field INT8 REFERENCES sometable NULL OK Er ... NULL *is* OK, unless you say field INT8 REFERENCES sometable NOT NULL regards, tom lane
Wow. That's a real head-slapper. Thanks for the quick answer! On Friday, November 29, 2002, at 11:28 PM, Tom Lane wrote: > "A.M." <agentm@cmu.edu> writes: >> In summary, what I want is > >> field INT8 REFERENCES sometable NULL OK > > Er ... NULL *is* OK, unless you say > > field INT8 REFERENCES sometable NOT NULL > > regards, tom lane > >><><><><><><><><>< AgentM agentm@cmu.edu
This is vital for my, please send me an exampleabout like I can make me to support my database with name WAREHOUSE -- Saludos de Luis, Mi correo: mailto:ksql2002@yahoo.com.mx _________________________________________________________ Do You Yahoo!? La emoci�n e intensidad del deporte en Yahoo! Deportes. http://deportes.yahoo.com.mx
At 10:36 PM 12/11/02, ksql wrote: >This is vital for my, please send me an example > about like I can make me to support my database with name WAREHOUSE pg_dump -o -c warehouse | gzip > warehouse.gz http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/backup.html