Re: r there downsides to explicitly naming a pk column xxxx_pk
От | David G. Johnston |
---|---|
Тема | Re: r there downsides to explicitly naming a pk column xxxx_pk |
Дата | |
Msg-id | CAKFQuwaq_r5jKERs+9vX2v6Ss=jQfAyKqBTYJHGXhGg-Drqsyw@mail.gmail.com обсуждение исходный текст |
Ответ на | r there downsides to explicitly naming a pk column xxxx_pk (john snow <ofbizfanster@gmail.com>) |
Ответы |
Re: r there downsides to explicitly naming a pk column xxxx_pk
Re: r there downsides to explicitly naming a pk column xxxx_pk |
Список | pgsql-novice |
instead of the more conventional xxxx_id or just id?sorry if this may be a foolish question to some, but i'm trying to think thrua junior colleagues's proposal. the discussion occurred while we werediscussing naming our foreign key constraints using the convention"childtable_parenttable_colname_fk".
Are you talking about the constraint name or the name of the column holding the data?
Identifiers in PostgreSQL can only be 64 characters (bytes?) long.
If it is the column name I wouldn't get too crazy or people writing out SQL joins manually will be asking you to pay their medical bills...
I generally avoid naming any column "id" - tables get short code aliases and those prefix the "id". I then name the column in the FK the exact same name. I rely on system defaults for choosing the names of the corresponding constraints and indexes.
David J.
В списке pgsql-novice по дате отправления: