![]() ![]() SET DEFAULT nextval('uses_serial_id_seq') With this method, you define a table as follows: This method is a shortcut for defining a sequence and setting a DEFAULT clause as above. Using the serial and bigserial pseudo-types PostgreSQL uses the DEFAULT value whenever the INSERT statement doesn’t explicitly insert that column. Id uuid DEFAULT gen_random_uuid() PRIMARY KEY, Id bigint DEFAULT nextval('integer_id_seq') PRIMARY KEY, ![]() You can use this method with sequences and UUIDs. There are four ways to define a column with automatically generated values: Using the DEFAULT clause Don’t try to convert them to strings or numeric - you will waste space and lose performance. Note that you should always use the PostgreSQL data type uuid for UUIDs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |