Re: [GENERAL] Emulating flexible regex replace

2014-10-23 Thread twoflower
Thank you Francisco, that's a clever idea. However, I don't think this would reduce the complexity since the target pattern can contain 1) regular back-references (referencing to matches of its own) 2) the special source text references I mentioned Obviously, these will have to be written in a di

Re: [GENERAL] Emulating flexible regex replace

2014-10-23 Thread blackbee045
This yields a successful match since $1 in the /target pattern/ is replaced > by "123" from the first captured group in *source* and the resulting > string, > "123 target text", matches the /target pattern/. > I would like to execute a query which for a given /source pattern/ and > /target pat

[GENERAL] Finding date intersections

2014-10-23 Thread Joe Van Dyk
I have a table of sales that have possibly overlapping time ranges. I want to find all the timeranges where there's an active sale. How would you do that? create table sales ( times tstzrange ); insert into sales values (tstzrange('2014-1-1', '2014-1-2')), (tstzrange('2014-1-2', '2014-1-3')

[GENERAL] is there a warm standby sync trigger?

2014-10-23 Thread John Smith
i want to setup a warm standby that listens 24/7 but only syncs when told to (ie only when i am ok with the database updates, will i trigger the sync). can i? i don't want to manually backup and restore like i do now. thks, jzs -- Sent via pgsql-general mailing list (pgsql-general@postgresql.

[GENERAL] Re[2]: [GENERAL] DBlink, postgres to DB2

2014-10-23 Thread Миша Тюрин
http://multicorn.org/ another cool stuff to generalize interconnections Wed, 22 Oct 2014 22:34:06 -0700 от Postgres India : >Thanks a lot Remi, Merlin and Pavel...I will give it a try. > >On Wed, Oct 22, 2014 at 6:36 AM, Merlin Moncure < mmonc...@gmail.com > wrote: >>On Wed, Oct 22, 201

[GENERAL] some queries on standby preventing replication updates

2014-10-23 Thread Joe Van Dyk
Hi, I have a master and a slave database. I've got hot_standby_feedback turned on, max_standby_streaming_delay=-1. I've configured the master and slave to keep a few days of WALs around. I've noticed that when some large queries are run on the standby machine (ones that take more than a minute o

Re: [GENERAL] Emulating flexible regex replace

2014-10-23 Thread David G Johnston
David G Johnston wrote > > twoflower wrote >> Source: 123 source text >> Target: 123 target text >> Source pattern: ([0-9]+) source text >> Target pattern: $1 target text >> >> Still, isn't there some super clever way to do that? > You use "\1" instead of "$1" > > SELECT regexp_replace('123 abc'

[GENERAL] Emulating flexible regex replace

2014-10-23 Thread Francisco Olarte
( Forgot reply all, forwarding a copy, sorry for the noise. ) Hullo. On Thu, Oct 23, 2014 at 4:03 PM, twoflower wrote: > > my scenario is this: I have a *SEGMENT* table with two text fields, > *source* > and *target*. From the user, I get the following input: > > /source pattern/ > /target patt

Re: [GENERAL] Emulating flexible regex replace

2014-10-23 Thread David G Johnston
twoflower wrote > Source: 123 source text > Target: 123 target text > Source pattern: ([0-9]+) source text > Target pattern: $1 target text > > Still, isn't there some super clever way to do that? You use "\1" instead of "$1" SELECT regexp_replace('123 abc','(\d+)\s(\w+)','\1 def'); --output: '1

Re: [GENERAL] Emulating flexible regex replace

2014-10-23 Thread Tom Lane
twoflower writes: > Supposing *source* matches the /source pattern/, the $/n/ expressions inside > the /target pattern/ correspond to the captured groups inside *source*. > Example: > Source: 123 source text > Target: 123 target text > Source pattern: ([0-9]+) source text > Target pattern: $1 ta

[GENERAL] Emulating flexible regex replace

2014-10-23 Thread twoflower
Hello, my scenario is this: I have a *SEGMENT* table with two text fields, *source* and *target*. From the user, I get the following input: /source pattern/ /target pattern/ Where both patterns are regexes and moreover the target pattern contains references to the source in the following way:

Re: [GENERAL] Inconsistency between PgAdmin III GUI and SQL window ?

2014-10-23 Thread Daniel Begin
Thank Adrian, I just found what went wrong in my script... As described in the initial email, I set the search path to the destination schema (xxx) prior to execute the script. Doing so, I was excluding the public schema from the search and then cannot have access to PostGIS extension. By setting