[GENERAL] Merge - Insert Select

2017-10-13 Thread Susan Hurst
What is the best practice for doing an INSERT...SELECT statement for new values only. Existing values must be excluded from the insert. Does postgres have a MERGE statement ala Oracle? I have found examples online for INSERT...ON CONFLICT DO NOTHING, but all of those examples use VALUES

Re: [GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Susan Hurst
On 2015-12-27 13:19, Tom Lane wrote: Andreas Kretschmer writes: The problem is, that tg_table_name isn't declared within a event trigger. TG_TAG is defined, it contains the command, for instance CREATE TABLE. Yeah. According to

[GENERAL] Calling function (table_name, schema_name) within event trigger

2015-12-27 Thread Susan Hurst
What is the correct syntax for calling a function from within an event trigger, passing in the table name and schema name as parameters to the function? The goal is to capture DDL changes to tables for the purpose of turning on (or off) auditing for production tables. The history_master

Re: [GENERAL] Unexpected Results from regexp_replace

2015-11-10 Thread Susan Hurst
. Johnston wrote: On Tue, Nov 10, 2015 at 1:12 PM, Susan Hurst <susan.hu...@brookhurstdata.com> wrote: What is the trick for removing all instances of unwanted characters and spaces? ​(g)lobal flag. SELECT regexp_replace('hello - world n', '[^0-9a-z]+', '', 'g') ​; David J.​ -- Sent via

[GENERAL] Unexpected Results from regexp_replace

2015-11-10 Thread Susan Hurst
I would like to extract only letters and numbers [0-9a-z] from an input string. Using regexp_replace in postgres, I get unexpected results. The pattern matching seems to stop before the end of the string value is reached. Some of the values that should have been excluded are still there.