snippetMinor
How to add function to particular column in while creating table in Postgres?
Viewed 0 times
whilepostgrescolumncreatingfunctionhowparticulartableadd
Problem
I want to add a function to particular column while creating a table in PostgreSQL. After creating table, it has to generate auto generated id when we insert values into to the table.
Solution
There is
If you want to have custom function then you need to create trigger functions first and assign it to the trigger on insert.
More in the postgresql docs:
http://www.postgresql.org/docs/9.4/static/datatype-numeric.html
serial and bigserial numeric type to autogenerate numbers i.e. autoincrement.If you want to have custom function then you need to create trigger functions first and assign it to the trigger on insert.
More in the postgresql docs:
http://www.postgresql.org/docs/9.4/static/datatype-numeric.html
Context
StackExchange Database Administrators Q#106664, answer score: 3
Revisions (0)
No revisions yet.