microo8/plgo

Can't make trigger

Closed this issue · 3 comments

I try use yours example on
VERSION = PostgreSQL 9.6.2
All function work correctly a part of CreatedTimeTrigger()

`CREATE TRIGGER gettrigger BEFORE INSERT OR UPDATE OR DELETE ON urls FOR EACH ROW EXECUTE PROCEDURE CreatedTimeTrigger();

CREATE TRIGGER so looks OK
`

`
func CreatedTimeTrigger(td *plgo.TriggerData) *plgo.TriggerRow {

// td.NewRow.Set(4, time.Now()) //set the 4th column to now()

// td.NewRow.Set(1, "trig")

// log.Println("trigget start")

return td.NewRow //return the new modified row

}
But after INSERT INTO urls VALUES ('333llssl');`

server closed the connection unexpectedly

This will have nothing to do with your issue but, what go version are you using?

I've didn't make anything with plgo in a while, and now I cannot build the shared objects file with go 1.10, because it don't want to accept the -shared flag in LDFLAGS:

invalid flag in #cgo LDFLAGS: -shared

I'm guessing it is this issue.

I am still --> on go version go1.9.2 linux/amd64
I try use as well use
rapidloop/ptgo#2
but I have isssue

The trigger data (new and old row) wasn't acquired as it has to be, so I've fixed it. Try to update plgo and build your trigger again. Close the issue if it is OK.

Also fixed the LDFLAGS problem :)