Re: [GENERAL] Issue with default values and Rule

2014-02-27 Thread Dev Kumkar
On Thu, Feb 27, 2014 at 11:17 PM, Adrian Klaver wrote: > That works because you said NULL is a valid value for the column. If you > had specified NOT NULL then you would get an error about violating the NOT > NULL constraint. Since you have said NULL is a valid value and you actually > specified i

Re: [GENERAL] Issue with default values and Rule

2014-02-27 Thread Adrian Klaver
On 02/27/2014 08:51 AM, Dev Kumkar wrote: On Thu, Feb 27, 2014 at 9:32 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: Realized my previous answer: col_2 = coalesce(my_test.col_2, NEW.col_2) works for the particular situation you described, but not for the general

Re: [GENERAL] Issue with default values and Rule

2014-02-27 Thread Dev Kumkar
On Thu, Feb 27, 2014 at 9:32 PM, Adrian Klaver wrote: > > Realized my previous answer: > > col_2 = coalesce(my_test.col_2, NEW.col_2) > > works for the particular situation you described, but not for the general > case. It would not allow an update of a field where a NON NULL value exists > and yo

Re: [GENERAL] Issue with default values and Rule

2014-02-27 Thread Adrian Klaver
On 02/27/2014 03:45 AM, Dev Kumkar wrote: Am facing issues with using UPSERT rule having default value columns. Here is the code: create table my_test (id int, col_1 timestamp null, col_2 varchar(12) null default 'Initial'); CREATE OR REPLACE RULE RULE_my_test AS ON INSERT TO my_test WHERE EX

Re: [GENERAL] Issue with default values and Rule

2014-02-27 Thread Adrian Klaver
On 02/27/2014 03:45 AM, Dev Kumkar wrote: Am facing issues with using UPSERT rule having default value columns. Here is the code: create table my_test (id int, col_1 timestamp null, col_2 varchar(12) null default 'Initial'); CREATE OR REPLACE RULE RULE_my_test AS ON INSERT TO my_test WHERE EX

[GENERAL] Issue with default values and Rule

2014-02-27 Thread Dev Kumkar
Am facing issues with using UPSERT rule having default value columns. Here is the code: create table my_test (id int, col_1 timestamp null, col_2 varchar(12) null default 'Initial'); CREATE OR REPLACE RULE RULE_my_test AS ON INSERT TO my_test WHERE EXISTS (SELECT 1 from my_test WHERE id = NEW.i