heroku-pg-extras icon indicating copy to clipboard operation
heroku-pg-extras copied to clipboard

Naming conventions

Open msakrejda opened this issue 11 years ago • 1 comments

Cleaning up the README for the vacuum PR, I noticed some inconsistencies in naming fields in the various queries we run, most notably referring to tables ('name', 'relname', 'table_name', 'table' are all used). Also, some queries include the schema; most omit it. It would be good to have some consistency here. How about the following:

  • use 'table' to refer to table names
  • omit schema if 'public', otherwise prepend it to the table name with a delimiter ('::' ?)

msakrejda avatar Apr 24 '13 20:04 msakrejda

Jumping on this: We have one database which uses multiple schemas, each with identical table names, as a result it's impossible to uniquely identify tables in the output.

E.g. for pg:table-size:

       name        |    size    
-------------------+------------
 source_apple      | 14 MB
 source_apple      | 14 MB
 source_banana     | 640 kB
 source_banana     | 600 kB
 source_clementine | 96 kB
 source_clementine | 88 kB

One option would be just to prepend n.nspname AS schema to the select, but I don't know if that would be considered too spammy (since the average user is probably going to just see a column of public).

davetapley avatar Apr 30 '14 18:04 davetapley