4

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.

Sathyajith Bhat
  • 1,504
  • 3
  • 18
  • 36
haider
  • 55
  • 1
  • 4

1 Answers1

3

There is 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

Mladen Uzelac
  • 829
  • 5
  • 8