From 9ce937f3060463fafe5523007ee4168ef825d12c Mon Sep 17 00:00:00 2001 From: lukaseder Date: Wed, 7 Nov 2018 17:17:54 +0100 Subject: [PATCH] [#7968] Document behaviour of unnamed expressions in the SELECT clause --- .../resources/org/jooq/web/manual-3.10.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.11.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.12.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.2.xml | 52 +++++++++++++++-- .../resources/org/jooq/web/manual-3.3.xml | 52 +++++++++++++++-- .../resources/org/jooq/web/manual-3.4.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.5.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.6.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.7.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.8.xml | 56 +++++++++++++++++-- .../resources/org/jooq/web/manual-3.9.xml | 56 +++++++++++++++++-- 11 files changed, 546 insertions(+), 62 deletions(-) diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml index a5fa8ffd76..60efe895e4 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml @@ -6814,8 +6814,25 @@ create.select().from(values( row(1, 2), row(3, 4) ).as("t", "a", "b")) -.fetch();]]> - +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -7309,9 +7326,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -9716,12 +9760,12 @@ from (

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -7485,9 +7502,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -9956,12 +10000,12 @@ select substr('abcde', 2, 3) from dual;]]>

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -7570,9 +7587,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -10083,12 +10127,12 @@ select substr('abcde', 2, 3) from dual;]]>

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +).as("t", "a", "b"));]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -4608,9 +4625,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.3.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.3.xml index 32b3b1e9e0..d55de1b695 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.3.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.3.xml @@ -4871,8 +4871,25 @@ create.select().from(unnest(myTableFunction()).as("t", "a", "b")); create.select().from(values( row(1, 2), row(3, 4) -).as("t", "a", "b"));]]> - +).as("t", "a", "b"));]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -5286,9 +5303,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.4.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.4.xml index 6307358435..9594a6f9e8 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.4.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.4.xml @@ -5751,8 +5751,25 @@ create.select().from(values( row(1, 2), row(3, 4) ).as("t", "a", "b")) -.fetch();]]> - +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -6182,9 +6199,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -8314,12 +8358,12 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -6566,9 +6583,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -8711,12 +8755,12 @@ field("replace(substr(quote(zeroblob(({0} + 1) / 2)), 3, {0}), '0', {1})", Strin

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -6686,9 +6703,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -8877,12 +8921,12 @@ condition("my_column IN ({0})", list(a, b, c)); // Using a single template ar

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -6950,9 +6967,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -9149,12 +9193,12 @@ condition("my_column IN ({0})", list(a, b, c)); // Using a single template ar

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -7126,9 +7143,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -9373,12 +9417,12 @@ condition("my_column IN ({0})", list(a, b, c)); // Using a single template ar

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered

- +.fetch();]]> + +

Unnamed derived tables

+ +

+ The type can reference a : +

+ + + + + + +

+ Most databases do not support unnamed derived tables, they require an explicit alias. If you do not provide jOOQ with such an explicit alias, an alias will be generated based on the derived table's content, to make sure the generated SQL will be syntactically correct. The generated alias is not specified and should not be referenced explicitly. +

+
@@ -7261,9 +7278,36 @@ GROUP BY FIRST_NAME, LAST_NAME;

System.out.println("Author : " + record.getValue("author")); -System.out.println("Books : " + record.getValue("books")); +System.out.println("Books : " + record.getValue("books")); - +

Unnamed column expressions

+ +

+ In most SQL databases, aliasing of column expressions in top level selects is optional. The database will generate a column name that is roughly based on the expression for documentation purposes (e.g. when running the query in a tool like SQL Developer), but applications cannot rely on the name explicitly. This is not a problem as columns can still be referenced by index. +

+ +

+ In a similar fashion, jOOQ will assume an unspecified, generated column name for column expressions, based on their content. +

+ + + + + + + +

+ These unnamed expressions can be used both in SQL as well as with jOOQ. However, do note that jOOQ will use to extract this column name from the field, when referencing the field or when nesting it in derived tables. In order to stay in full control of any such column names, it is always a good idea to provide explicit aliasing for column expressions, both in SQL as well as in jOOQ. +

+
@@ -9507,12 +9551,12 @@ condition("my_column IN ({0})", list(a, b, c)); // Using a single template ar

- For the above reasons, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered + For the above reasons, and also to prevent an additional SQL injection risk where names might contain SQL code, jOOQ by default quotes all names in generated SQL to be sure they match what is really contained in your database. This means that the following names will be rendered