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 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 some point in time.

Re: [GENERAL] WAL log archival on standby

2015-06-20 Thread Sameer Kumar
On Fri, 19 Jun 2015 13:46 Michael Paquier wrote: On Fri, Jun 19, 2015 at 2:38 PM, James Sewell wrote: Hey All, Is it possible to create WAL archive files on standby servers when using streaming replication? Yes and no, standbys do not archive WAL in ~9.4, but you could use archive_mode = 'al

[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 ; --with or without a cast RETURN ; END; $$; The goal is to return the value of text_to_return wit

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

2015-06-20 Thread Tom Lane
"David G. Johnston" 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 ; --with or without a cast > RETURN ; > END; > $$; >

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 wrote: > "David G. Johnston" 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 'te

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 (2,'T

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

2015-06-20 Thread Jerry Sievers
Adrian Klaver writes: > On 06/19/2015 01:05 PM, Paula Price wrote: > >> >> >> On Fri, Jun 19, 2015 at 12:01 PM, Adrian Klaver >> mailto: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

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

2015-06-20 Thread Jerry Sievers
"David G. Johnston" writes: > On Sat, Jun 20, 2015 at 10:56 AM, Tom Lane wrote: > > "David G. Johnston" 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

[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 vi

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 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

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

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 n