Is there a best practice on upper/lower case for data types in PostgreSQL

Viewed 785

I realize not everyone frets over such things, but I prefer to "do in Rome" and therefore have adhered to uppercase SQL and snake_case for table names, field names, variables, etc. in the PostgreSQL environment.

However on data types I haven't quite made out if there is any widely held (semi?) standard.

Looking for guidance, I perused this source document... unfortunately it goes both ways. For example (text/TEXT) see below...

CREATE FUNCTION dup(int) RETURNS TABLE(f1 int, f2 text) ...
CREATE FUNCTION check_password(uname TEXT, pass TEXT) ...

So is it the wild west on this topic? Nobody cares? Or...

1 Answers

This is opinion based, but I'd argue that you should use lower case for type names. My reasoning is to use upper case for keywords and lower case for identifiers, and type names are identifiers.

Related