0

I have a table that looks like this:

CREATE TABLE tabley(
   log          text, -- something like this you get the point
   created      timestamptz NOT NULL DEFAULT NOW()
)

And I want to let a postgres user INSERT their own arbitrary log but I want to make sure they are not allowed to set their own arbitrary created. Is there any clean way to enforce this?

  • I think following will help you - https://stackoverflow.com/questions/15411735/postgresql-restrict-update-on-specific-columns-read-only – Maxqueue Dec 11 '21 at 04:17
  • @Maxqueue that's an interesting idea, using an on-insert trigger to set the `created` field so that it can't be overridden – Rojer Vairs Dec 11 '21 at 04:48

0 Answers0