Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: [OT] SQL "on duplicate key" custom action

by erix (Parson)
on Oct 21, 2019 at 16:25 UTC ( #11107769=note: print w/replies, xml ) Need Help??


in reply to Re: [OT] SQL "on duplicate key" custom action
in thread [OT] SQL "on duplicate key" custom action

Do you perhaps have a tested version? I can't get this to run.

The trigger functions are all right, it seems, but I don't see how to create the triggers themselves onto the table 'records' so that they react in the desired way. (For one thing, you can't do an 'INSTEAD OF UPDATE' on a table, and when you use a BEFORE INSERT or an AFTER INSERT trigger, this old. and new. business is not going to work.)

  • Comment on Re^2: [OT] SQL "on duplicate key" custom action

Replies are listed 'Best First'.
Re^3: [OT] SQL "on duplicate key" custom action
by Corion (Pope) on Oct 21, 2019 at 16:34 UTC

    No, sorry - I don't have a tested version, and I'm not on the machine where I did the searches.

    I worked from the Postgres 12 documentation and some Stackoverflow response, but I don't find them now :( I think it should be a before update trigger and the statement would be insert or update maybe. But again, I didn't test any of this, sorry.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11107769]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2019-11-18 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (91 votes). Check out past polls.

    Notices?