Re: [SQL] order of rows in update

2008-09-03 Thread Achilleas Mantzios
Στις Wednesday 03 September 2008 15:28:04 ο/η Richard Broersma έγραψε: > On Tue, Sep 2, 2008 at 11:56 PM, Achilleas Mantzios > <[EMAIL PROTECTED]> wrote: > > I am using my version of DB mirror to do some kind of "Conditional row > > grained + FK dependency oriented lazy replication". > > (The logi

[SQL] Case-insensitive string prefix matching with parameterized query

2008-09-03 Thread Christopher Maier
Apologies if this posts twice... I've run into issues with the listserv lately. I am implementing an autosuggest-style text input for my site, where a user can start typing the name of a thing (call it a 'Foo'), and get a list of all things whose name starts with the string the user typed.

Re: [SQL] How do I get min and max from an array of floating point values

2008-09-03 Thread Yura Gal
If you use intarray type it is convenient to call buil-in intarray functions for your purpose. http://www.postgresql.org/docs/8.3/static/intarray.html SELECT t.a[1] AS "min", t.a[array_upper(t.a, 1)] AS "max" FROM (SELECT sort(string_to_array('2,3,4,15,6,7',',')::int[]) AS a)t; -- Best regards,

Re: [SQL] order of rows in update

2008-09-03 Thread Richard Broersma
On Tue, Sep 2, 2008 at 11:56 PM, Achilleas Mantzios <[EMAIL PROTECTED]> wrote: > I am using my version of DB mirror to do some kind of "Conditional row > grained + FK dependency oriented lazy replication". > (The logic behind it is the cost of comms, because the slaves are servers in > vessels in

Re: [SQL] How do I get min and max from an array of floating point values

2008-09-03 Thread Pavel Stehule
Hello 2008/9/2 pw <[EMAIL PROTECTED]>: > Hello, > > Is it possible to get the min and max from an array of > floating point values? > > The following doesn't return the min of the array values > it simply returns the complete array...(??) > > SELECT min(string_to_array('1,2,3,4,5,6,7',',')::float[

Re: [SQL] seemingly slow for-loop in plpgsql

2008-09-03 Thread Claus Guttesen
> Why in the world are you using a for-loop for this at all? It would be > tremendously faster as a single SQL command: > > update duplicates set hashcode = rtrim(hashcode, E'\n') where > length(hashcode) = 33; Thank you. I was "caught" in the plpgsql-lane. This is of course much simpler and muc