[DOCS] Doc BUG and/or Change Request: Include Postgres's system columns inreserved words in docs, Chnage to previx sytem colums with 2 underscores? - Mailing list pgsql-docs

From dan d
Subject [DOCS] Doc BUG and/or Change Request: Include Postgres's system columns inreserved words in docs, Chnage to previx sytem colums with 2 underscores?
Date
Msg-id CY4PR1801MB18131A6E442EB74D59F2170CA1720@CY4PR1801MB1813.namprd18.prod.outlook.com
Whole thread Raw
Responses Re: [DOCS] Doc BUG and/or Change Request: Include Postgres's systemcolumns in reserved words in docs, Chnage to previx sytem colums with 2 underscores?  (Euler Taveira <euler@timbira.com.br>)
List pgsql-docs

Vitals:

Postgres 9.6 on Windows 7

by way of NpgSql C# library (v4.0.30319)



DOC BUG:  
I'm curious if PostgreSQL's own special columns should be included on the "Reserved Words" list.  This might be obvious to those familiar with the inner working of Postgres, for us that are more application level developers this may not be as obvious..  Easy to know the core sql tokens are reserved such as "select, min, like, from, and others..." are all reserved.  The issue was encountered when trying to create a table with cmax as a column name.   Following the instructions on filing bugs I searched the main site and eventually found it is documented but not clearly.  Found that cmax is a system column reserved by Postgres.  At first when i got the error specifically this one:

Npgsql.PostgresException (0x80004005): 42701: column name "cmax" conflicts with a system column name

My first step was to google "Postgres Reserved Words"   will eventually get you to Appendix C in the doc but not mention about any system columns, url for help page:

https://www.postgresql.org/docs/9.6/static/sql-keywords-appendix.html

title on page shows (This page in other versions: 9.2 / 9.3 / 9.4 / 9.5 / current (9.6) )

It wasn't until i looked at the process to open a bug, did it get to the main Postgres site and searched for cmax.  Searching on the Postgres site, bingo, I found cmax instead is a system column.  So it seems at first to be a documentation bug that Postgres's own reserved column names are not put in the "Reserved Words" list. 


Change Request:

Got me thinking what the convention use to be in C starting out 30 years ago, should work good in Postgres as well?  Most all C compilers would prefix variables or items within system  struct that were considered system/reserved with an underscores or two.  This worked great before C++ which brought classes and namespaces to assist in scoping.  This practice worked well to prevent name collisions between users code the compiler itself should work nicely in Postgres too.  Finally if this convention is adapted there could be one generic note in the docs saying "User columns should never being with an underscore."  This convention worked well for C before C++ exists, should work good for Postgres too?

Thanks for your consideration.

dan d:)

pgsql-docs by date:

Previous
From: marco.pennekamp96@gmail.com
Date:
Subject: [DOCS] Levenshtein function cost parameters are in the wrong order
Next
From: Alexander Lakhin
Date:
Subject: Re: [DOCS] list of credits for release notes