I’m currently trying to use Postgres’s identity columns for auto-incrementing primary keys, instead of serial, but I’m unsure how to get it to work properly. First, I tried setting it in the config with
@Un3qual, is it resolved? I am trying to run the same but via execute.
I am always getting postgres error, i understand its not a ecto issue, but how to add generated columns? No examples on this at ecto docs.
I am trying to run this:
ALTER TABLE USERS ALTER COLUMN AGE ADD GENERATED ALWAYS AS (extract year from age(now(), dob)) STORED; => error
ALTER TABLE USERS DROP COLUMN AGE;
ALTER TABLE USERS ADD COLUMN AGE TYPE INT GENERATED ALWAYS AS (extract year from age(now(), dob)) STORED; => error
* (Postgrex.Error) ERROR 42601 (syntax_error) syntax error at (2 errors)
1. or near "INT"
2. or near "GENERATED"