Re: [SQL] Storing an ordered list

2006-07-26 Thread Michael Artz
On 7/26/06, Bruno Wolff III <[EMAIL PROTECTED]> wrote: If you use numeric instead of int, then it is easy to insert new values. Hmm, hadn't thought about that. How would you normally implement it? I'm thinking that, if I wanted to insert between A and B, I could take (A.order + B.order)/2, whi

Re: [SQL] Storing an ordered list

2006-07-26 Thread Michael Artz
On 7/26/06, Aaron Bono <[EMAIL PROTECTED]> wrote: If you use the linked list, remember this: to reduce the updates you are going to need more code in the application as it will have to keep track of what to update and what to not update. It will also be more difficult to order the items using SQ

Re: [SQL] DBD::Pg ... how would I format this prepare?

2006-07-26 Thread Marc G. Fournier
On Wed, 26 Jul 2006, Jim Buttafuoco wrote: try now() + (? || ' day')::interval Perfect ... had thought of that, but put my ) after ::interval instead of before ;( Thx ... -- Original Message --- From: "Marc G. Fournier" <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org

Re: [SQL] DBD::Pg ... how would I format this prepare?

2006-07-26 Thread Jim Buttafuoco
try now() + (? || ' day')::interval -- Original Message --- From: "Marc G. Fournier" <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Sent: Wed, 26 Jul 2006 18:29:32 -0300 (ADT) Subject: [SQL] DBD::Pg ... how would I format this prepare? > I need to do: > > NOW() + '2 day'::in

Re: [SQL] DBD::Pg ... how would I format this prepare?

2006-07-26 Thread Tom Lane
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > if I do: > NOW() + '? day'::interval > it, of course, takes the ? as a literal ... so is there some way I can do > this such that I can do the placeholder? NOW() + n * '1 day'::interval n can be any numeric value ... regar

[SQL] DBD::Pg ... how would I format this prepare?

2006-07-26 Thread Marc G. Fournier
I need to do: NOW() + '2 day'::interval where 2 is a variable ... if I do: NOW() + '? day'::interval it, of course, takes the ? as a literal ... so is there some way I can do this such that I can do the placeholder? Thx Marc G. Fournier Hub.Org Networking Services (http://

Re: [SQL] Storing an ordered list

2006-07-26 Thread Bruno Wolff III
On Tue, Jul 25, 2006 at 22:58:47 -0400, Michael Artz <[EMAIL PROTECTED]> wrote: > > I figure that one choice is to explicitly code the order as an integer > column in the predicate table which has the advantage of being very > easy and fast to query/order but *very* slow to reorder as all of the

Re: [SQL] Help with privilages please

2006-07-26 Thread Andrew Hammond
7.4.1 is quite old and has a number of serious known bugs. I'd suggest you either upgrade to 8.1.4 (current) or, if you can't do that, at least upgrade to 7.4.13 (latest 7.4) immediately. Hilary Forbes wrote: > Tom > > Thank you - I think that the underlying problem is that I was trying out > >

Re: [SQL] Rows with exclusive lock

2006-07-26 Thread Andrew Hammond
Martin Marques wrote: > On Sun, 23 Jul 2006, Alvaro Herrera wrote: > > > Martin Marques escribió: > >> > >> After the SELECT FOR UPDATE other transactions can still see the locked > >> rows. I want a read/write lock, so no one can access does rows. > > > > SELECT FOR UPDATE acquires an exclusive l

Re: [SQL] SQL generator

2006-07-26 Thread Andrew Sullivan
On Wed, Jul 26, 2006 at 10:21:01AM -0500, Aaron Bono wrote: > Bottom line though, just how difficult is SQL to read and write anyway? It > is a hell of a lot easier to read and write than any other computer language > I have seen. It's not SQL. It's the notion of relations. If the language were

Re: [SQL] SQL generator

2006-07-26 Thread Aaron Bono
On 7/25/06, Chris Browne <[EMAIL PROTECTED]> wrote: "Bit Byter" <[EMAIL PROTECTED]> writes:> I would like to know what the underlying SQL statement will look> like, so that I can use this knowlege to build a generic parser that > creates SQL statements from the "English like" text, using the> synta

Re: [SQL] Storing an ordered list

2006-07-26 Thread Aaron Bono
On 7/25/06, Michael Artz <[EMAIL PROTECTED]> wrote: What is the best way to store and ordered list that can be updatedOLTP-style?  A simplified problem is that I have an event, and theevent has an ordered list of predicates and I need to preserve theorder of the predicates.  All of the data is ente

Re: [SQL] About Div

2006-07-26 Thread Aaron Bono
On 7/25/06, Otniel Michael <[EMAIL PROTECTED]> wrote: Mr. Aaron. I am sorry, your solution didn't match in my case. Example for your solution :A = 1B = 1C = 1D = 1E = 1F = 1G = 4G have 4 candy. Its too much for G.In my case, the solution is : A = 1B = 1C = 1D = 1E = 2F = 2G = 2The extra candy is gi