Re: [SQL]

2002-11-29 Thread A.M.
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." <[EMAIL PROTECTED]> writes: In summary, what I want is field INT8 REFERENCES sometable NULL OK Er ... NULL *is* OK, unless you say field INT8 REFERENCES so

Re: [SQL]

2002-11-29 Thread Tom Lane
"A.M." <[EMAIL PROTECTED]> 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 ---(end of broadcast)---

[SQL]

2002-11-29 Thread A.M.
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

[SQL] ALTER TABLE x DROP CONSTRAINT fkey

2002-11-29 Thread Thomas Good
Pardon stupidiy, what is the right syntax for dropping a foreign key? Struggling here! TIA --- Thomas Good e-mail: [EMAIL PROTECTED] Programmer/Analyst phone: (+1) 718.

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
I've worked out a way of doing it by vreating a view for the tally info as: create view link_tally as select lklid, lktype, count(*) from links group by lklid, lktype; and then doing: select r.rtid, r.rtname, l.count from route r left outer join link_tally l on r.rtid = l.lklid and l.lktype =

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Dan Langille
On 29 Nov 2002 at 13:16, Achilleus Mantzios wrote: > On Fri, 29 Nov 2002, Gary Stainburn wrote: > > > As you can see from the extract below, your statement has worked for all > > landmarks that have links, but ignores any landmarks with out links. How can > > I adjust this so that all landmarks

[SQL] import sql script

2002-11-29 Thread Rafal Kedziorski
Hallo, I have a big sql script, which creates about 120 tables. much of them have FK to other tables. The order in this sql script is not correct. Tables which be create at least, while they have FK to other table, are defined bevore. Is there any way to import this structure to PostgreSQL without

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Achilleus Mantzios
On Fri, 29 Nov 2002, Gary Stainburn wrote: > As you can see from the extract below, your statement has worked for all > landmarks that have links, but ignores any landmarks with out links. How can > I adjust this so that all landmarks are listed, but with a zero count where > appropriate? Then,

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
As you can see from the extract below, your statement has worked for all landmarks that have links, but ignores any landmarks with out links. How can I adjust this so that all landmarks are listed, but with a zero count where appropriate? select r.rtid, r.rtname, subsel.cnt from route r, (sele

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Richard Huxton
On Friday 29 Nov 2002 10:06 am, Gary Stainburn wrote: > Hi folks. > > I've got a master detail relationship where I have a railway route table > listing landmarks along the route, and a Links table listing URL's > associated with that landmark. Listed below: > > How can I do a query showing the la

Re: [SQL] Analyze + Index

2002-11-29 Thread Richard Huxton
On Friday 29 Nov 2002 4:45 am, Rudi Starcevic wrote: > Hi, > > I think I've found what I need to know. > From techdocs.postgresql.org > > >> Every you run an INSERT, UPDATE, or DELETE on an indexed table, > > PostgreSQL must update all of the table's indexes to reflect the new > data (unlike some

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Achilleus Mantzios
On Fri, 29 Nov 2002, Gary Stainburn wrote: > Hi folks. > > I've got a master detail relationship where I have a railway route table > listing landmarks along the route, and a Links table listing URL's > associated with that landmark. Listed below: > > How can I do a query showing the landmark ID,

[SQL] master-detail relationship and count

2002-11-29 Thread Gary Stainburn
Hi folks. I've got a master detail relationship where I have a railway route table listing landmarks along the route, and a Links table listing URL's associated with that landmark. Listed below: How can I do a query showing the landmark ID, the landmark name, and a count of links associated w

Re: [SQL] Big query problem

2002-11-29 Thread Christoph Haller
> > DELETE FROM table WHERE col1='something' AND col2 IN > ('aasdoijhfoisdfsdoif','sdfsdfsdfsadfsdf', ... ); > > In the parantheses I have 6400 names, each about 20 characters. I'm > using libpq from C. This did not work very well, but the result was > very unexpected. > The conditional operator I