Re: [GENERAL] Postgresql 9.2 has standby server lost data?

2015-06-20 Thread Paula Price
On Fri, Jun 19, 2015 at 12:01 PM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 06/18/2015 05:45 PM, Paula Price wrote: I have Postgresql 9.2.10 streaming replication set up with log shipping in case the replication falls behind. I discovered that the log-shipping had been disabled at

Re: [GENERAL] WAL log archival on standby

2015-06-20 Thread Sameer Kumar
On Fri, 19 Jun 2015 13:46 Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Jun 19, 2015 at 2:38 PM, James Sewell james.sew...@lisasoft.com wrote: Hey All, Is it possible to create WAL archive files on standby servers when using streaming replication? Yes and no, standbys do not

Re: [GENERAL] Trying to avoid a simple temporary variable declaration in a pl/pgsql function

2015-06-20 Thread Tom Lane
David G. Johnston david.g.johns...@gmail.com writes: I know this could be written quite easily in sql but was wondering if it is possible in pl/pgsql. CREATE FUNCTION test_func() RETURNS text LANGUAGE 'plpgsql' AS $$ BEGIN SELECT 'text_to_return' INTO what_goes_here?; --with or without a

Re: [GENERAL] Trying to avoid a simple temporary variable declaration in a pl/pgsql function

2015-06-20 Thread David G. Johnston
On Sat, Jun 20, 2015 at 10:56 AM, Tom Lane t...@sss.pgh.pa.us wrote: David G. Johnston david.g.johns...@gmail.com writes: I know this could be written quite easily in sql but was wondering if it is possible in pl/pgsql. CREATE FUNCTION test_func() RETURNS text LANGUAGE 'plpgsql' AS

Re: [GENERAL] Postgresql 9.2 has standby server lost data?

2015-06-20 Thread Jerry Sievers
Adrian Klaver adrian.kla...@aklaver.com writes: On 06/19/2015 01:05 PM, Paula Price wrote: On Fri, Jun 19, 2015 at 12:01 PM, Adrian Klaver adrian.kla...@aklaver.com mailto:adrian.kla...@aklaver.com wrote: On 06/18/2015 05:45 PM, Paula Price wrote: I have Postgresql 9.2.10

Re: [GENERAL] Trying to avoid a simple temporary variable declaration in a pl/pgsql function

2015-06-20 Thread Jerry Sievers
David G. Johnston david.g.johns...@gmail.com writes: On Sat, Jun 20, 2015 at 10:56 AM, Tom Lane t...@sss.pgh.pa.us wrote: David G. Johnston david.g.johns...@gmail.com writes: I know this could be written quite easily in sql but was wondering if it is possible in pl/pgsql.

[GENERAL] Trying to avoid a simple temporary variable declaration in a pl/pgsql function

2015-06-20 Thread David G. Johnston
I know this could be written quite easily in sql but was wondering if it is possible in pl/pgsql. CREATE FUNCTION test_func() RETURNS text LANGUAGE 'plpgsql' AS $$ BEGIN SELECT 'text_to_return' INTO what_goes_here?; --with or without a cast RETURN what_goes_here?; END; $$; The goal is to return

Re: [GENERAL] Trying to avoid a simple temporary variable declaration in a pl/pgsql function

2015-06-20 Thread Charles Clavadetscher
Hello The solution proposed by Tom works as long as you can make sure that your SELECT statement in the function will return a single row with a single column of type TEXT: CREATE TABLE test (id INTEGER, what_goes_here TEXT); INSERT INTO test values (1,'Text 1'); INSERT INTO test values

[GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-20 Thread litu16
In PostgreSQL I have this table... (there is a primary key in the most left side timestamp02 which is not shown in this image) in the table above, all columns are entered via querrys, except the time_index which I would like to be filled automatically via a trigger each time each row is filled.

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-20 Thread Adrian Klaver
On 06/20/2015 10:44 AM, litu16 wrote: In PostgreSQL I have this table... (there is a primary key in the most left side timestamp02 which is not shown in this image) in the table above, all columns are entered via querrys, except the time_index which I would like to be filled automatically via a

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-20 Thread Adrian Klaver
On 06/20/2015 12:41 PM, Charles Clavadetscher wrote: Hello I just made a short test with the code provided. As Bill mentioned the moment when the trigger is fired is essential. I made a test with both before (worked) and after (did not work because the row was already inserted and the returned

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-20 Thread Bill Moran
On Sat, 20 Jun 2015 10:44:21 -0700 (MST) litu16 litumelen...@gmail.com wrote: In PostgreSQL I have this table... (there is a primary key in the most left side timestamp02 which is not shown in this image) in the table above, all columns are entered via querrys, except the time_index which I

Re: [GENERAL] INSERT a number in a column based on other columns OLD INSERTs

2015-06-20 Thread Charles Clavadetscher
Hello I just made a short test with the code provided. As Bill mentioned the moment when the trigger is fired is essential. I made a test with both before (worked) and after (did not work because the row was already inserted and the returned new row is ignored). The assignment (= or :=) does