Re: Insert data if it is not existing - Mailing list pgsql-general

From David G. Johnston
Subject Re: Insert data if it is not existing
Date
Msg-id CAKFQuwa7JFd0ayELKnFD7KmmgNZxTLX_=KVBBqyzq50ngof0Pw@mail.gmail.com
Whole thread Raw
In response to Re: Insert data if it is not existing  (tango ward <tangoward15@gmail.com>)
Responses Re: Insert data if it is not existing  (tango ward <tangoward15@gmail.com>)
List pgsql-general
On Wednesday, May 23, 2018, tango ward <tangoward15@gmail.com> wrote:
Thanks masters for responding again.

I've tried running the code:

INSERT INTO my_table(name, age)
SELECT name, age
WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name)


this doesn't give me error but it doesn't insert data either.


I'm doubting your assertion that it doesn't error.   How do you run that query such that age and name are recognized given the main query doesn't have a from clause?

David J.

pgsql-general by date:

Previous
From: tango ward
Date:
Subject: Re: Insert data if it is not existing
Next
From: Adrian Klaver
Date:
Subject: Re: Insert data if it is not existing