Sequence on a char(6) column
От | Roland Giesler |
---|---|
Тема | Sequence on a char(6) column |
Дата | |
Msg-id | TAXNET017G1TMe7Xn4U000000bb@frontdoor.taxpoint.co.za обсуждение исходный текст |
Ответы |
Re: Sequence on a char(6) column
Re: Sequence on a char(6) column |
Список | pgsql-novice |
Is it possible to create a sequence like 'ABC012','ABC013', etc. in a char(6) column? I'm toying with some ideas... I actually need to generate random 6 digit membership number in the format 'CCCNNN' (where C is a character A-Z and D a digit 0-9). The idea is to have a number like a South African motorvehicle registration (also used elsewhere) in the format XYZ123. For security reasons a member number like this should be random and I'm wondering if anybody has done something like this in a pl/pgsql. I guess a procedure like this could be used as a default for a column, and making the column unique could prevent duplicates, although this should ideally be done as part of the generating procedure, not afterwards. A sample, or pointers would all be appreciated. Thanks Roland
В списке pgsql-novice по дате отправления: