how to amend SQL standard to add comments? - Mailing list pgsql-general

From Aleksey Tsalolikhin
Subject how to amend SQL standard to add comments?
Date
Msg-id CA+jMWodj1wrR+dZ=nxVNayguEJBG+SpoHmT=APst4qV647HjFw@mail.gmail.com
Whole thread Raw
Responses Re: how to amend SQL standard to add comments?
List pgsql-general
Hi.  Does anybody here know how to add comments to the SQL standard?
I believe this would benefit lots of people.

Situation:  When a system administrator or database administrator looks at
a gnarly SQL query chewing up system resources, there is no way to tell
by looking at the query server-side which application it came from, what its
purpose is, and who the author or responsible party is.

Data: in ANSI SQL standard, you can put single-line comments by preceeding
the line with a double-hyphen.  These comments will be thrown away by the
database client and the server will never see them.  Hence the metadata
(the data about the query itself) is lost.

I propose it'd be a benefit, in today's day of distributed and inter-dependent
systems, to pass that data along with the query so that it could be used
in troubleshooting if needed.

An SQL comment may look something like

SELECT STUDENT_ID from STUDENTS
  WHERE LAST_NAME = 'Smith' and FIRST_NAME = 'Joe'
  COMMENT 'Query Author: Bob Programmer.   Purpose: Pull the student ID
                      number, we'll need it to enroll the student for classes.';

or

SELECT STUDENT_ID FROM STUDENTS
  WHERE LAST_NAME = 'Smith' and FIRST_NAME = 'Joe'
  COMMENT 'Get the Student ID.  Bob Programmer, 9 April 2012.
registration.py, line 612';

In the second example, the program that queries the DB can dynamically
identify where in the program the query-generating code is located.

I'd like to propose such capability be added to the SQL standard...  is anybody
on this list involved with the SQL standard?   What do you think about the
idea?

Best regards,
Aleksey Tsalolikhin

pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Streaming replication: sequences on slave seemingly ahead of sequences on master
Next
From: Thomas Kellerer
Date:
Subject: Re: how to amend SQL standard to add comments?