Official PostgreSQL Capitalization conventions Is there an official PostreSQL convention regarding capitalization in DB, Table and field names?

The examples on the official site suggest a lowercase and _ word separation, and I wonder whether this policy is official.

CREATE TABLE films (
    code        char(5) CONSTRAINT firstkey PRIMARY KEY,
    title       varchar(40) NOT NULL,
    did         integer NOT NULL,
    date_prod   date,
    kind        varchar(10),
    len         interval hour to minute
);
I'm going to basically mirror Verace's comments and state this, making it semi-official:

There is no one best practice that will cover every circumstance. What follows makes the following assumptions (and what to do if you haven't done this):


You have already discussed this with your team (people working by themselves often just have to make up their mind)
There is no formalized style definition for SQL already on your team (Otherwise you wouldn't be asking us)
There is no formalized style definition for any code (Follow the same basic conventions already established for other languages and formalize a style)


So the rest of this is somewhat opinionated but based on experience


When it comes to table names 

You should go for singular entity names (this makes documentation easier)
You should use Pascal Case here

When it comes to field names

Use camelCase on your field names
Use short singular names unless the definition definitely makes sense as a plural (it almost never does)

When it comes to your own function or stored procedure names

Use underscore_separation
Use field naming for the parameterization

When it comes to built in database functions or language names (eg SELECT)

Unless there's a requirement for it to be capitalized a certain way, use ALL CAPS
Know the APIs for your language to know what's reasonable or required

When it comes to spacing

A lot of folks use column alignment for keywords and indentation for things which are not keywords
A lot of folks use commas at the beginning of the row when the fields are separated on each line (This makes it easier to comment out a specific field from a selection list)
Never use spaces as part of the names of things, not even for return value headers.

When it comes to punctuation

Parentheses - USE THEM. They're FREE. I promise.
Semicolons - USE THEM. They're not going to break you. They force you to think out your code. And they're good hygiene.
Carriage Returns - Once again, they're free ;-) And make your code readable.



You should also recognize that while I'm trying to help you apply a generic style guide, that the community for Postgres generally doesn't use camelCase or PascalCase but instead uses underscore_separation. The really important bit is to ensure that you establish and use a specific style everywhere to be consistent.