Underscores or camelCase in PostgreSQL identifiers, when the programming language uses camelCase?

后端 未结 3 1690
悲&欢浪女
悲&欢浪女 2021-02-01 12:02

This has been bothering me for a while, and I can\'t arrive at a solution that feels right...

Given an OO language in which the usual naming convention for object

3条回答
  •  伪装坚强ぢ
    2021-02-01 12:45

    Given that PostgreSQL uses case-insensitive identifiers with underscores, should you change all your identifiers in your application to do the same? Clearly not. So why do you think the reverse is a reasonable choice?

    The convention in PostgreSQL has come about through a mix of standards compliance and long-term experience of its users. Stick with it.

    If translating between column-names and identifiers gets tedious, have the computer do it - they're good at things like that. I'm guessing almost all of the 9-million database abstraction libraries out there can do that. If you have a dynamic language it'll take you all of two lines of code to swap column-names to identifiers in CamelCase.

提交回复
热议问题