Re: [GENERAL] Sub-query having NULL row returning FALSE result

2016-07-01 Thread Sridhar N Bamandlapally
Hi Just for info. Actual query in Oracle (below) -- MERGE INTO relDocumentTypeMetaDataName t USING (SELECT ? as DocumentTypeID, ? as DocumentContextID, ? as MetaDataNameID, ? as DocumentAbstractionIndexID FROM DUAL) s ON (t.MetaDataNameID = s.MetaDataNameID AND t.D

Re: [GENERAL] Sub-query having NULL row returning FALSE result

2016-06-29 Thread David G. Johnston
On Wed, Jun 29, 2016 at 2:07 AM, Sridhar N Bamandlapally < sridhar@gmail.com> wrote: > Hi > > Please go through below case > > postgres=# CREATE TABLE emp (id INTEGER unique, ename VARCHAR); > CREATE TABLE > postgres=# INSERT INTO emp VALUES (null, 'aaa'); > INSERT 0 1 > postgres=# INSERT INTO

Re: [GENERAL] Sub-query having NULL row returning FALSE result

2016-06-29 Thread Sridhar N Bamandlapally
Hi The actual statement is MERGE INTO NOT MATCHED, which in PG migrated to WITH - INSERT however, yes, the SQL-statement in previous does not work in other databases too, I was wrong Thanks, thanks again Sridhar OpenText On Wed, Jun 29, 2016 at 11:58 AM, Tom Lane wrote: > Sridhar N Bamandla

Re: [GENERAL] Sub-query having NULL row returning FALSE result

2016-06-28 Thread Tom Lane
Sridhar N Bamandlapally writes: > postgres=# CREATE TABLE emp (id INTEGER unique, ename VARCHAR); > postgres=# INSERT INTO emp VALUES (null, 'aaa'); > ... > postgres=# INSERT INTO emp SELECT * FROM (SELECT 5::integer id, > 'eee'::varchar ename) nr WHERE id NOT IN (SELECT id FROM emp); > INSERT 0 0