What about add support of COMMENT for table to CREATE TABLE statement?

487 views
Skip to first unread message

Илья Ненашев

unread,
Apr 4, 2021, 11:02:13 AM4/4/21
to H2 Database
H2 already have optional COMMENT part in the column definition statement (http://www.h2database.com/html/grammar.html#column_definition) for CREATE TABLE statement (http://www.h2database.com/html/commands.html#create_table) but comment for the entire table still must be provided in separated COMMENT ON statement (http://www.h2database.com/html/commands.html#comment)

I would like to have a COMMENT part in CREATE TABLE statement to provide a comment for this table.

Please register this feature request.

UPD: I look to try to create a pool request, and have found https://github.com/h2database/h2database/blob/7ad4fd5df1bbbce79c760cb15f186b8a404b2fdf/h2/src/main/org/h2/command/Parser.java#L10323 it is already implemented!

So please update the documentation!

Evgenij Ryazanov

unread,
Apr 4, 2021, 12:19:14 PM4/4/21
to H2 Database
Hello.

Syntax of comments on columns in their definitions exists mostly for a some limited compatibility with MySQL, but it was included into documentation for some bad historic reason. Actually it shouldn't be documented and should be accepted only in the related compatibility modes, but what's done is done.

Comments on database objects aren't a part of the SQL Standard, so they are not portable across DBMS. Native support in H2 is provided by a separate COMMENT ON command and there is no intention to add some random alternative grammar for this purpose, unless some grammar will be standardized or at least will be widely supported by multiple DBMS.

Syntax that you found in the parser is internal only, it should never be used by users of H2. It is intentionally not documented.

Ilya Nenashev

unread,
Apr 4, 2021, 12:53:55 PM4/4/21
to h2-da...@googlegroups.com
Yes, I know that is non-ANSI SQL.
But it already exists, and it's clever and I think it can be published to a little bit increase social  pressure to SQL vendors to support this syntax in other databases.

вс, 4 апр. 2021 г. в 19:19, Evgenij Ryazanov <kat...@gmail.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/z5kQDMUdA7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/3571faf4-584e-42f3-9f48-9d917688b51cn%40googlegroups.com.

Evgenij Ryazanov

unread,
Apr 4, 2021, 11:01:13 PM4/4/21
to H2 Database
Various internal clauses are usually poorly designed and sometimes they're changed due to revealed problems or other reasons. They need to be carefully redesigned first, and even if we'll do so, most likely nobody will try to implement the same syntax in other DBMS.

Ilya Nenashev

unread,
Apr 5, 2021, 5:38:27 AM4/5/21
to h2-da...@googlegroups.com
It's looks designed good enough, and it will not dramatically changed if it will be documented. 

And even no others implement it in other DBMS, it will be pleasant to use in H2.

пн, 5 Апр 2021, 6:01 Evgenij Ryazanov <kat...@gmail.com>:
Various internal clauses are usually poorly designed and sometimes they're changed due to revealed problems or other reasons. They need to be carefully redesigned first, and even if we'll do so, most likely nobody will try to implement the same syntax in other DBMS.

--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/z5kQDMUdA7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages