Re: [GENERAL] Do not INSERT if UPDATE fails

2017-08-04 Thread Alexander Farber
Hello, I have followed David's suggestion (thank you!) - On Wed, Aug 2, 2017 at 6:40 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wed, Aug 2, 2017 at 8:58 AM, Alexander Farber < > alexander.far...@gmail.com> wrote: > >> However if the user record is not found or the user

Re: [GENERAL] Do not INSERT if UPDATE fails

2017-08-03 Thread Francisco Olarte
On Wed, Aug 2, 2017 at 6:23 PM, Scott Marlowe wrote: > Does insert's "on conflict" clause not work for this usage? Did you even bother to read the queries? He is using two different tables. Francisco Olarte. -- Sent via pgsql-general mailing list

Re: [GENERAL] Do not INSERT if UPDATE fails

2017-08-02 Thread David G. Johnston
On Wed, Aug 2, 2017 at 8:58 AM, Alexander Farber wrote: > However if the user record is not found or the user already has vip_until > >= CURRENT_TIMESTAMP (i.e. the user has already purchased "vip status") I > would like to cancel the INSERT. > > ​You can "join" two

Re: [GENERAL] Do not INSERT if UPDATE fails

2017-08-02 Thread Scott Marlowe
Does insert's "on conflict" clause not work for this usage? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Do not INSERT if UPDATE fails

2017-08-02 Thread Alexander Farber
Good evening, I have a custom SQL function in PostgreSQL 9.5.7 which adds a "log entry" to the table words_payments and then updates "vip_until" column in another table: CREATE OR REPLACE FUNCTION words_buy_vip( in_sid text, in_social integer, in_tid text, in_item