Re: [GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread David Waddy
Thank-you, mystery solved! I was reading the "CREATE TABLE" docs and not the "CREATE TABLE AS" docs. My mistake. David Waddy On Sun, Feb 12, 2012 at 3:50 PM, Adrian Klaver wrote: > On Sunday, February 12, 2012 11:42:37 am David Waddy wrote: > > This works: > > CREATE TEMP TABLE temp_medical_sum

Re: [GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread Adrian Klaver
On Sunday, February 12, 2012 11:42:37 am David Waddy wrote: > This works: > CREATE TEMP TABLE temp_medical_summary AS (SELECT * from > bov.medical_summary) > > This gives an error: > CREATE TEMP TABLE IF NOT EXISTS temp_medical_summary AS (SELECT * from > bov.medical_summary) > > It would seem th

[GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread David Waddy
This works: CREATE TEMP TABLE temp_medical_summary AS (SELECT * from bov.medical_summary) This gives an error: CREATE TEMP TABLE IF NOT EXISTS temp_medical_summary AS (SELECT * from bov.medical_summary) It would seem that CREATE TABLE AS does not support IF NOT EXISTS. Is this true? David Waddy

Re: [GENERAL] Regex match not back-referencing in function

2012-02-12 Thread Thom Brown
On 12 February 2012 18:49, Tom Lane wrote: > Thom Brown writes: >> What am I missing? > > I might be more confused than you, but I think you're supposing that > the result of ascii(E'\\1') has something to do with the match that > the surrounding regexp_replace function will find, later on when i

Re: [GENERAL] Regex match not back-referencing in function

2012-02-12 Thread David Johnston
On Feb 12, 2012, at 13:26, Thom Brown wrote: > Hi, > > Could someone explain the following behaviour? > > SELECT regexp_replace(E'Hello & goodbye ',E'([&])','&#' || > ascii(E'\\1') || E';\\1'); > > This returns: > > regexp_replace > > Hello \& goodbye > (1 row) >

Re: [GENERAL] Regex match not back-referencing in function

2012-02-12 Thread Tom Lane
Thom Brown writes: > What am I missing? I might be more confused than you, but I think you're supposing that the result of ascii(E'\\1') has something to do with the match that the surrounding regexp_replace function will find, later on when it gets executed. The actual arguments seen by regexp_

[GENERAL] Regex match not back-referencing in function

2012-02-12 Thread Thom Brown
Hi, Could someone explain the following behaviour? SELECT regexp_replace(E'Hello & goodbye ',E'([&])','&#' || ascii(E'\\1') || E';\\1'); This returns: regexp_replace Hello \& goodbye (1 row) So it matched: SELECT chr(92); chr - \ (1 row) But notice that w