This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 1120343831 Bug fix in the handling of enumerated values for EPSG table 
names.
1120343831 is described below

commit 11203438313a1da9f18e5d53f4483054555a0992
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Aug 14 18:47:30 2025 +0200

    Bug fix in the handling of enumerated values for EPSG table names.
---
 .../org/apache/sis/referencing/factory/sql/SQLTranslator.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
index 462b5fbbc1..784539212e 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/SQLTranslator.java
@@ -230,6 +230,7 @@ public class SQLTranslator implements UnaryOperator<String> 
{
      * Non-null if the {@value #ENUMERATION_COLUMN} column in {@code "Alias"} 
table uses enumeration instead
      * than character varying. In such case, this field contains the 
enumeration type. If {@code null}, then
      * then column type is {@code VARCHAR} and the cast can be omitted.
+     * If non-null, this string should contain the identifier quotes.
      *
      * @see #useEnumerations()
      */
@@ -483,8 +484,11 @@ check:  for (;;) {
                      * Enumerations appear in various tables, including in a 
WHERE clause for the Alias table.
                      */
                     if (ENUMERATION_COLUMN.equals(column)) {
-                        final String type = 
result.getString(Reflection.TYPE_NAME);
+                        String type = result.getString(Reflection.TYPE_NAME);
                         if (!CharSequences.startsWith(type, "VARCHAR", true)) {
+                            if (!type.contains(identifierQuote)) {
+                                type = identifierQuote + type + 
identifierQuote;
+                            }
                             tableNameEnum = type;
                         }
                     }
@@ -697,7 +701,7 @@ check:  for (;;) {
             int w = buffer.lastIndexOf(ENUMERATION_COLUMN + "=?");
             if (w >= 0) {
                 w += ENUMERATION_COLUMN.length() + 1;
-                buffer.replace(w, w+1, "CAST(? AS \"" + tableNameEnum + "\")");
+                buffer.replace(w, w+1, "CAST(? AS " + tableNameEnum + ')');
             }
         }
         return buffer.toString();

Reply via email to