Re: [SQL] Max Conncection limit?

2001-03-12 Thread Frank Joerdens
On Tue, Mar 13, 2001 at 11:33:10AM -0500, Najm Hashmi wrote: > We start a server and initiate 30 connections(with the libpq C interface) > which are stored in a stack to use and and to be reused. > > After awhile I try to start another server that will also try to initiate 30 > connections, f

Re: [SQL] Re: How to drop an trigger

2001-03-08 Thread Frank Joerdens
On Thu, Mar 08, 2001 at 05:06:29PM +0100, Frank Joerdens wrote: > On Thu, Mar 08, 2001 at 04:42:46PM +0100, Frank Joerdens wrote: > > I've created quite a few foreign key constraints in the database that I > > am currently working on, and now that I've altered the st

[SQL] Re: How to drop an trigger

2001-03-08 Thread Frank Joerdens
On Thu, Mar 08, 2001 at 04:42:46PM +0100, Frank Joerdens wrote: > I've created quite a few foreign key constraints in the database that I > am currently working on, and now that I've altered the structure and > dropped a table that had a foreign key reference to a couple of oth

[SQL] How to drop an trigger

2001-03-08 Thread Frank Joerdens
I've created quite a few foreign key constraints in the database that I am currently working on, and now that I've altered the structure and dropped a table that had a foreign key reference to a couple of other tables, I need to get rid of those foreign keys (they weren't dropped automagically wit

[SQL] Weird NOT IN effect with NULL values

2001-03-01 Thread Frank Joerdens
When doing a subselect with NOT IN, as in SELECT name FROM customer WHERE customer_id NOT IN ( SELECT customer_id FROM salesorder ); (from Bruce Momjian's book) I get no rows if the result column returned by the subselect contains NULL values. It works as expected if I remove the NULL values fr

Re: [SQL] logging a psql script

2001-02-21 Thread Frank Joerdens
On Wed, Feb 21, 2001 at 04:51:00PM -0500, Ken Kline wrote: > Hello, >I would like my psql script to log everything that it does. > I set the following > > \set ECHO all > \o foo.txt > \qecho > > some sql, some ddl, etc... > > \o > > > But foo.txt only contains > > DROP > DROP > DROP > CR

Re: [SQL] two tables - foreign keys referring to each other...

2001-02-21 Thread Frank Joerdens
On Tue, Feb 20, 2001 at 11:34:30PM -0800, Stephan Szabo wrote: > > You have to use ALTER TABLE to add the constraint to one of the tables. Maybe I am stating the obvious but you should make sure that you include the ALTER TABLE statements in the *.sql files that you use to create the tables, rat

[SQL] displaying constraints

2001-02-14 Thread Frank Joerdens
The only what that I am aware of in which you can display the constraints that have been created for a table is by dumping out the schema with the -s option and then trying to reconstruct the foreign key references from the triggers which where created by the e.g. some_column int4 references

[SQL] Making a foreign key chain - good idea or bad idea?

2001-01-24 Thread Frank Joerdens
I just did something which seems to work alright and which makes sense to me now but which I have a funny feeling about. It may be good standard practice (and I just don't know about it) or dangerously foolish or just plain silly: I created a foreign key reference on a column that is also the prim

Re: [SQL] Tree structure table normalization problem (do I need a trigger?)

2000-12-19 Thread Frank Joerdens
Josh Berkus wrote: [ . . . ] > This is exactly why my model includes a "Level" column. I looked at your post from a few days ago again; you did indeed explain about the level column. I missed that somehow and had to reinvent the wheel . . . > > This means > > you need a loop control structure wh

Re: [SQL] Tree structure table normalization problem (do I need atrigger?)

2000-12-19 Thread Frank Joerdens
> Michael Ansley wrote: > > Hi, Frank, > > This is exactly why there are alternative solutions for trees. The mechanism that >you > are using traded input speed for 'queryability', and this is where you start to run >into > problems. Either you need to store redundant information (i.e.: the

Re: [SQL] Tree structure table normalization problem (do I need atrigger?)

2000-12-19 Thread Frank Joerdens
Tulassay Zsolt wrote: [ . . . ] > The SQL stuff of that nested set structure is fairly easy, I wrote some > quick'n'dirty plpgsql functions that will do inserts, updates, deletes > from the tree, display level number etc. What scared me about it in particular was one scenario where you try to del

[SQL] Tree structure table normalization problem (do I need a trigger?)

2000-12-18 Thread Frank Joerdens
In a recent thread (How to represent a tree-structure in a relational database) I asked how to do a tree structure in SQL, and got lots of suggestions (thanks!), of which I chose the one below: create table Category ( CategoryID int4 not null primary key, ParentCategoryID int4 not null

Re: [SQL] Subqueries in Non-SELECT Queries

2000-12-18 Thread Frank Joerdens
Christof Glaser wrote: [ . . . ] > since the where clause compares just one field for equality. You might > try IN instead of =, ie > > update index set level = 2 where parentid in ( select id from > index where level = 1 ); That was it! Thanks, Frank

[SQL] Subqueries in Non-SELECT Queries

2000-12-17 Thread Frank Joerdens
I am trying to do something that looks to me exactly like what's described in chapter 8.4 in the Postgresql book: test=> UPDATE salesorder test-> SET ship_date = '11/16/96' test-> WHERE customer_id = ( test(> SELECT customer_id test(> FROM customer test(> WHERE name = 'Fleer Gearworks, Inc.' tes

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
On Wed, Dec 13, 2000 at 11:04:13AM -0800, Josh Berkus wrote: > Frank, > > Please look in the list archives. About 2 months ago this topic came > up and was discussed extensively (including a creative solution by yours > truly). Hm, neither my archives nor a search on the postgresql.org pa

Re: [SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
On Wed, Dec 13, 2000 at 11:38:18AM -0800, Stuart Statman wrote: [ . . . ] > I would suggest, instead, to create a table that represents your hierarchy > without adding columns. For example : > > create table Category ( > CategoryID int4 not null primary key, > ParentCategoryID int4 not n

[SQL] How to represent a tree-structure in a relational database

2000-12-13 Thread Frank Joerdens
I am just thinking about the data model for a little content management system that I am currently planning. Individual articles are sorted under different categories which branch into subcategories, sub-subcategories etc. up to a depth of about 6 or 7 levels. The structure should be extensible,