Tom Lane wrote:
> Marek Lewczuk <newsy@lewczuk.com> writes:
>
>>I'm curious if the default scheme for sequence name (which is created
>>with SERIAL data type) can be changed -- currently all sequences are
>>named like this: <table_name>_<field_name>_seq -- can it be changed for
>>e.g. <table_name>__<field_name>__seq ???
>
>
> Sure ... just hack one or two places in the sources ...
>
> That probably wasn't the answer you wanted, but I'm quite unsure what you did want.
I just asked is it can be done (somehow...).
> Are you suggesting the above would be a better default
> naming scheme? Are you saying you want user-configurability of implicit
> sequence names? In either case, what's your argument why we should
> invest effort and possibly create backwards-compatibility issues?
I'm not saying that proposed naming scheme is better - I think that it
is more readable, and I'm using it in my project.
Look at below examples:
Primary key:
1. <table_name>__pkey
(e.g. my_clients__pkey)
Foreign key:
1. <table_name>__<field>__fkey
(e.g. my_clients__client_id__fkey)
2. <table_name>__<field>_<field>__fkey
(e.g. my_clients__client_id_company_id__fkey)
Index:
1. <table_name>__<field>__index
(e.g. my_clients__country__index)
2. <table_name>__<field>_<field>_<field>__index
(e.g. my_clients__country_city_street__index)
Sequence:
1. <table_name>__<field>__seq
(e.g. my_clients__client_id__seq)
As you can see all naming schemes are very similar, and becouse of this
I just wanted to know if there is something like "user-configurability
implicit of sequence names". I didn't want to propose NEW naming scheme
- but maybe my naming schemes are worth looking at.
ML