Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Oleg Bartunov
On Wed, 17 Nov 2004, Achilleus Mantzios wrote: O Oleg Bartunov ?? Nov 17, 2004 : Gary, if you need really fast solution for you task and dont't afraid non-standard soltion, take a look on contrib/ltree module. http://www.sai.msu.su/~megera/postgres/gist/ltree/ Oleg Oleg how would you co

Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Achilleus Mantzios
O Oleg Bartunov έγραψε στις Nov 17, 2004 : > Gary, > > if you need really fast solution for you task and dont't afraid > non-standard soltion, take a look on contrib/ltree module. > http://www.sai.msu.su/~megera/postgres/gist/ltree/ > > Oleg Oleg how would you compare an ltree solution a

Re: [SQL] tree structure photo gallery date quiery

2004-11-17 Thread Oleg Bartunov
Gary, if you need really fast solution for you task and dont't afraid non-standard soltion, take a look on contrib/ltree module. http://www.sai.msu.su/~megera/postgres/gist/ltree/ Oleg On Wed, 17 Nov 2004, Gary Stainburn wrote: On Tuesday 16 November 2004 1:08 pm, sad wrote: On Tuesday 16

Re: [SQL] tree structure photo gallery date quiery

2004-11-16 Thread Mike Rylander
Gary, If you're not to worried about tying yourself to Postgres and you're sure you want to create a tree structure, you may want to check out the ltree contrib module. It will allow you to create an index over the entire tree, and will allow you to use real names instead of INTs for the nodes in

Re: [SQL] tree structure photo gallery date quiery

2004-11-16 Thread Gary Stainburn
On Tuesday 16 November 2004 1:08 pm, sad wrote: > On Tuesday 16 November 2004 14:29, Gary Stainburn wrote: > > Hi folks. > > > > I'm looking at the possibility of implementing a photo gallery for > > my web site with a tree structure > > > > How would I go about creating a view to show a) the numbe

Re: [SQL] tree structure photo gallery date quiery

2004-11-16 Thread Pierre-Frédéric Caillaud
I'm looking at the possibility of implementing a photo gallery for my web site with a tree structure, something like: You don't really want a tree structure, because one day you'll want to put the same photo in two galleries. Suppose you take a very interesting photo of celery during your tri

Re: [SQL] tree structure photo gallery date quiery

2004-11-16 Thread Rod Taylor
On Tue, 2004-11-16 at 11:29 +, Gary Stainburn wrote: > > How would I go about creating a view to show a) the number of photos > in > a gallery and b) the timestamp of the most recent addition for a > gallery, so that it interrogates all sub-galleries? There isn't a very simple answer to tha

Re: [SQL] tree structure photo gallery date quiery

2004-11-16 Thread sad
On Tuesday 16 November 2004 14:29, Gary Stainburn wrote: > Hi folks. > > I'm looking at the possibility of implementing a photo gallery for my > web site with a tree structure > How would I go about creating a view to show a) the number of photos in > a gallery and b) the timestamp of the most rec

[SQL] tree structure photo gallery date quiery

2004-11-16 Thread Gary Stainburn
Hi folks. I'm looking at the possibility of implementing a photo gallery for my web site with a tree structure, something like: create table gallery ( id serial, parent int4, name varchar(40), primary key (id)); create table photos ( pid serial, id int4 references gallery not null, added t

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

2000-12-29 Thread Ron Peterson
Frank Joerdens wrote: > > 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 k

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 Tulassay Zsolt
On Tue, 19 Dec 2000, Frank Joerdens wrote: > 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

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

2000-12-19 Thread Josh Berkus
Frank, > However, I have > a problem now > which seems non-trivial: I am at some point in the tree, > say 3 nodes > down from the root, but I don't know where I am exactly > (across which > nodes would I travel along the shortest path to the top?) > and would like > to find out. This is, again, n

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

2000-12-19 Thread Neil Thompson
On Tue, 19 Dec 2000, Frank Joerdens wrote: > Tulassay Zsolt wrote: > [ . . . ] > > I can send it to you if you like (please allow a few days since I > > have several exams at the university this week). > > Sure, I'd like to have a look at it! I'd like to have a look at it as well, please. Che

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

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

2000-12-19 Thread Tulassay Zsolt
On Tue, 19 Dec 2000, Frank Joerdens wrote: > 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

[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] Tree structure

2000-09-12 Thread Albert REINER
On Mon, Sep 11, 2000 at 01:27:48PM +0100, Trewern, Ben wrote: > Anybody know how to make a tree structure using related tables using > Postgres. Something like a directory structure is what I'm aiming for. I'm > sure there is an easy way but I'm having probs. I am not quite sure whether this is

RE: [SQL] Tree structure

2000-09-12 Thread Trewern, Ben
Title: RE: [SQL] Tree structure Any details you can supply would be appreciated.  I have got a table at the moment as:  id |  group_name  | parentid ---  1  | Main |  2  | Group    |  3  | User |  4  | Group1   |  1  5  | Group2   |  1

Re: [SQL] Tree structure

2000-09-12 Thread Zeljko Trogrlic
Thanks for your offer, I'll be very interested to see how you did that. I also found very interesting solution at http://www.dbmsmag.com/9603d06.html http://www.dbmsmag.com/9604d06.html http://www.dbmsmag.com/9605d06.html At 11:22 12.9.2000 , kovacsz wrote: >We are using tree structures (and par

Re: [SQL] Tree structure

2000-09-11 Thread Zeljko Trogrlic
Normally it's done with self-relation. You need a table with "ID" and "PARENT_ID". PARENT_ID will contain null for root level and other row's ID for children. One warning: going through such tree could be slow. I don't know is there anything PostgreSQL specific that might help. I know that Oracle

[SQL] Tree structure

2000-09-11 Thread Trewern, Ben
Title: Tree structure Anybody know how to make a tree structure using related tables using Postgres.  Something like a directory structure is what I'm aiming for.  I'm sure there is an easy way but I'm having probs. Any help would be appreciated. Ben.