[GENERAL] Alphanumeric natural order sorting : need generic solution

2013-03-22 Thread Umashanker, Srividhya
All, I am looking for a generic solution to get the Alphanumeric sorting. * The user can request for any field to be sorted. * There is no specific format the alphanumeric string can follow. So that we can split using regex and split and sorted. * Need an efficient wa

Re: [GENERAL] Alphanumeric natural order sorting : need generic solution

2013-03-22 Thread Albe Laurenz
Umashanker, Srividhya wrote: > I am looking for a generic solution to get the Alphanumeric sorting. > > * The user can request for any field to be sorted. > * There is no specific format the alphanumeric string can follow. So > that we can split using > regex and split and sorted

Re: [GENERAL] Alphanumeric natural order sorting : need generic solution

2013-03-22 Thread John R Pierce
On 3/22/2013 12:40 AM, Umashanker, Srividhya wrote: Rows with orderby   I am expecting     1, bay1 2, bay2 10, bay10 11, bay11 ...  order by id,name; -- john r pierce

Re: [GENERAL] [pgeu-general] Alphanumeric natural order sorting

2013-03-22 Thread Heikki Linnakangas
(pgeu-general is not the right list for technical discussions, moving to pgsql-general) On 20.03.2013 10:46, Albe Laurenz wrote: Umashanker, Srividhya wrote: I am looking for a solution the Alphanumeric sorting I am expecting 1, bay1 2, bay2 10, bay10 11, bay11 We are working on a framew

Re: [GENERAL] streaming replication question

2013-03-22 Thread wd
On Fri, Mar 22, 2013 at 11:27 AM, Roberto Scattini < roberto.scatt...@gmail.com> wrote: > > > On Thursday, March 21, 2013, wd wrote: > > You can combine warm standby and streaming, we do this in our product > database. > > When the standby is to far from the master, the slave will try to use > re

[GENERAL] Why is pg_xlog/archive_status of HotStandby synced with master?

2013-03-22 Thread Juraj Fabo
Hi I have SLES 11 SP2 in virtual boxes with postgres 9.2.2. My target is to have Master /Hotstandby (HS) with streaming replication (SR) managed with corosync/pacemaker beside also regular archivation of database. I started with testing of archivation and replication I noticed that pg_xlog/archiv

[GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Bertrand Janin
I noticed how rows were re-written to a different location (new ctid) even without changes to the values. This illustrate what I mean: CREATE TABLE demo (id serial, value text); -- generate a few pages of dummy data INSERT INTO demo (value) SELECT md5(s.a::text) FROM gener

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Adrian Klaver
On 03/22/2013 05:32 AM, Bertrand Janin wrote: I noticed how rows were re-written to a different location (new ctid) even without changes to the values. This illustrate what I mean: CREATE TABLE demo (id serial, value text); -- generate a few pages of dummy data INSERT INTO demo (

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Albe Laurenz
Adrian Klaver wrote: > On 03/22/2013 05:32 AM, Bertrand Janin wrote: >> I noticed how rows were re-written to a different location (new ctid) even >> without changes to the values. This illustrate what I mean: >> -- ctid = (0,1) >> SELECT id, xmin, ctid, value >> FROM demo >> W

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Ryan Kelly
On Fri, Mar 03/22/13, 2013 at 06:16:11AM -0700, Adrian Klaver wrote: > On 03/22/2013 05:32 AM, Bertrand Janin wrote: > >I noticed how rows were re-written to a different location (new ctid) even > >without changes to the values. This illustrate what I mean: > > > > CREATE TABLE demo (id serial,

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Tom Lane
Ryan Kelly writes: > I'm having trouble understanding why it is necessary to generate a new > tuple even when nothing has changed. It seems that the OP understands > that MVCC is at work, but is questioning why this exact behavior occurs. > I too have the same question. It's not *necessary* to do

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Adrian Klaver
On 03/22/2013 06:41 AM, Ryan Kelly wrote: On Fri, Mar 03/22/13, 2013 at 06:16:11AM -0700, Adrian Klaver wrote: On 03/22/2013 05:32 AM, Bertrand Janin wrote: I noticed how rows were re-written to a different location (new ctid) even without changes to the values. This illustrate what I mean:

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Kevin Grittner
Ryan Kelly wrote: > I'm having trouble understanding why it is necessary to generate a new > tuple even when nothing has changed. It seems that the OP understands > that MVCC is at work, but is questioning why this exact behavior occurs. > I too have the same question. > > Perhaps you could provi

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Hannes Erven
Hi folks, On 2013-03-22 13:32, Bertrand Janin wrote: >UPDATE demo >SET value = value >WHERE id = 1; On 2013-03-22 14:55, Tom Lane wrote: > It's not *necessary* to do so. However, avoiding it would require sitting there and comparing the old and new tuples, But in this case, no

Re: [GENERAL] Re: Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13

2013-03-22 Thread Alexander Farber
Hello, unfortunately octal doesn't seem to work either - On Tue, Mar 19, 2013 at 7:03 PM, Tom Lane wrote: > Alexander Farber writes: >> # select 'АБВГД' ~ '^[\u0410-\u042F]{2,}$'; >> WARNING: nonstandard use of escape in a string literal > > I think Unicode escapes were introduced in 9.0. In

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Bertrand Janin
Hannes Erven wrote : > Hi folks, > > > On 2013-03-22 13:32, Bertrand Janin wrote: > >UPDATE demo > >SET value = value > >WHERE id = 1; > > > On 2013-03-22 14:55, Tom Lane wrote: > > > >It's not *necessary* to do so. However, avoiding it would require > >sitting there and comparing

[GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Alexander Farber
Hello, how to get rid of this warning on a PostgreSQL 8.4.13 prompt? # select 'axyz' ~ '(.)\1\1'; WARNING: nonstandard use of escape in a string literal LINE 1: select 'axyz' ~ '(.)\1\1'; ^ HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. ?col

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Rob Sargent
On 03/22/2013 08:53 AM, Alexander Farber wrote: Hello, how to get rid of this warning on a PostgreSQL 8.4.13 prompt? # select 'axyz' ~ '(.)\1\1'; WARNING: nonstandard use of escape in a string literal LINE 1: select 'axyz' ~ '(.)\1\1'; ^ HINT: Use the esc

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Alexander Farber
Thank you, this works better, but - On Fri, Mar 22, 2013 at 3:57 PM, Rob Sargent wrote: > On 03/22/2013 08:53 AM, Alexander Farber wrote: >> >> # select 'axyz' ~ '(.)\1\1'; >> WARNING: nonstandard use of escape in a string literal >> LINE 1: select 'axyz' ~ '(.)\1\1'; >>

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Victor Yegorov
2013/3/22 Alexander Farber : > the result is correctly "true" now, > but the warning is still there, why? > > # select 'axyz' ~ '(.)\\1\\1'; > WARNING: nonstandard use of \\ in a string literal > LINE 1: select 'axyz' ~ '(.)\\1\\1'; > ^ > HINT: Use the escape s

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Alban Hertroys
On 22 March 2013 16:08, Alexander Farber wrote: > Thank you, this works better, but - > the result is correctly "true" now, > but the warning is still there, why? > > # select 'axyz' ~ '(.)\\1\\1'; > WARNING: nonstandard use of \\ in a string literal > LINE 1: select 'axyz' ~ '(.)\\1\

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Tom Lane
Hannes Erven writes: > On 2013-03-22 13:32, Bertrand Janin wrote: >>> UPDATE demo >>> SET value = value >>> WHERE id = 1; > On 2013-03-22 14:55, Tom Lane wrote: >> It's not *necessary* to do so. However, avoiding it would require >> sitting there and comparing the old and new tuples, > But in t

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Alexander Farber
Thanks, I finally get it - this works fine: # select 'axyz' ~ E'(.)\\1\\1'; ?column? -- t (1 row) # select 'ОШИБББКА' ~ E'(.)\\1\\1'; ?column? -- t (1 row) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http:/

Re: [GENERAL] Re: Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13

2013-03-22 Thread Alexander Farber
My insert trigger for 8.4.13 works now: http://sqlfiddle.com/#!11/c74a1/3 Thank you for you help -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Alphanumeric natural order sorting : need generic solution

2013-03-22 Thread Martín Marqués
2013/3/22 John R Pierce > On 3/22/2013 12:40 AM, Umashanker, Srividhya wrote: > > Rows with orderby > > > > I am expecting > > > > > > 1, bay1 > > 2, bay2 > > 10, bay10 > > 11, bay11 > > > ... order by id,name; > > That would be true if the last digits of the name attribute is equal to the id a

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
Hi, Not clear what is expected result - if you add new dimension... a) three columns? - well not possible to write SQL query which returns undefined number of columns... unfortunatelly - though I am not clear why :) b) But you can get the similar result as from python... my guess is you expect:

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
correction: 2013/3/22 Misa Simic > Hi, > > Not clear what is expected result - if you add new dimension... > > a) three columns? - well not possible to write SQL query which returns > undefined number of columns... unfortunatelly - though I am not clear why :) > > b) But you can get the similar

Re: [GENERAL] How to join table to itself N times?

2013-03-22 Thread Misa Simic
correction: WITH RECURSIVE t ( SELECT array_agg('{}'::text[], value) AS values, ord + 1 AS next_dim_ord, ord AS agg_dims FROM market_segment_dimension_values INNER JOIN market_segment_dimensions USING (market_segment_dimension) WHERE ord = 1 UNION ALL SELECT array_agg(t.values, value) AS values,

[GENERAL] PostgreSQL EXCLUDE USING error: Data type integer has no default operator class

2013-03-22 Thread Denver Timothy
In PostgreSQL 9.2.3 I am trying to create this simplified table: CREATE TABLE test ( user_id INTEGER, startend TSTZRANGE, EXCLUDE USING gist (user_id WITH =, startend WITH &&) ); But I get this error: ERROR: data type integer has no default operator class for

Re: [GENERAL] PostgreSQL EXCLUDE USING error: Data type integer has no default operator class

2013-03-22 Thread Ryan Kelly
On Fri, Mar 03/22/13, 2013 at 10:14:45AM -0600, Denver Timothy wrote: > In PostgreSQL 9.2.3 I am trying to create this simplified table: > > CREATE TABLE test ( > user_id INTEGER, > startend TSTZRANGE, > EXCLUDE USING gist (user_id WITH =, startend WITH &&) > ); >

[GENERAL] Group by -- precedence question

2013-03-22 Thread Joe Van Dyk
begin; create table f (v numeric); insert into f values (1), (0.8); select ceil(v) as v from f group by v; -- sorta expected the result to be grouped by the column alias, -- not by the in the table v ─── 1 1 This is the correct behavior, right? To group by the column alias, I'd have to use "g

Re: [GENERAL] Group by -- precedence question

2013-03-22 Thread Jov
jov On Mar 23, 2013 9:26 AM, "Joe Van Dyk" wrote: > > begin; > create table f (v numeric); > insert into f values (1), (0.8); > select ceil(v) as v from f group by v; > > -- sorta expected the result to be grouped by the column alias, > -- not by the in the table > > v > ─── > 1 > 1 > > This is