[OpenSER-Devel] id column name

Dan Pascu dan at ag-projects.com
Sat Nov 24 16:05:08 UTC 2007


On Saturday 24 November 2007, Juha Heinanen wrote:
> Dan Pascu writes:
>  > I'm not asking for this to be done before the release. I'm asking if
>  > you're willing to accept this change (after the release) to improve
>  > consistency in the naming of the primary table id.
>
> in this particular case, name grp_id adds value, because it is not just
> any unique number, but the SAME value as value of corresponding grp_id
> column in gw table.

Prefixing with the table name is not necessary to have that added value, 
because the table name already puts it in the right context:

... WHERE lcr.grp_id = gw_grp.id ...

as opposed to the superfluous and unnecessary double grp prefix:

... WHERE lcr.grp_id = gw_grp.grp_id

It's already obvious that grp_id from the lcr table points to the id from 
the gw_grp table.

If it were like you suggest we would need to name every primary key as 
tablename_id which would make it have a different name in every table.

Consider another example of linking say the grp table with the subscriber 
table:

... WHERE subscriber.id = grp.subscriber_id ...

No need to name it subscriber_id in the subscriber table as it's already 
in the proper context.

-- 
Dan



More information about the Devel mailing list