Re: sql trees move some element

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: sql trees move some element
Date: 2003-10-30 09:24:34
Message-ID: 20031030102434.E621@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I have a table:
> id | integer | not null default
> nextval('public.menu_2_id_seq'::text)
> parent_id | integer |
> description | text | not null
>
> how am I able to move some element with id = x before or after
> element with id = y ?
In relational databases there is no such concept of "before"
and "after". If you want to make id.x smaller then id.y you
can just update the column id to the values you desire. You
then need to make sure that you don't get in the way of the id
value of other rows. One way to do it would be to compare the
values of id.x and id.y and switch them around if necessary.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-10-30 09:26:26 Re: slow query performance
Previous Message Gianni Mariani 2003-10-30 09:13:34 Re: Sending email from PL/pgsql