Create custom sequence for PostgreSQL Primary Key with auto-increment.

You can use standard sequence and formatting functions to customise the value.
to_char(nextval('test_seq'), 'TS0000000FM') 
FM : prefix fill mode (suppress padding blanks and trailing zeroes)

CREATE TABLE test_table
 s_no CHAR(8) NOT NULL DEFAULT to_char(nextval('test_seq'), 'TS0000000FM'),
 txt TEXT
ALTER SEQUENCE test_seq OWNED BY test_table.s_no; 

You can read more on this example and about postgresql formatting functions in following links.

sources :

Popular posts from this blog

npm refusing to install as a dependency of itself

How to call javascript functions from VB.NET and using WebBrowser Control