[libpostgresql-jdbc-java] 10/11: Escaping of savepoint names in org.postgresql.jdbc3.PSQLSavepoint is incorrect. Backslashes in (double-quoted) savepoint names are doubled for escaping, but AFAIK, and as my testing shows, savepoint names are like identifiers, so regular identifier quoting applies to them.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL8_1_408
in repository libpostgresql-jdbc-java.

commit ef74f7175ac77a7ad6a7751e99219cafb06be855
Author: Kris Jurka <books at ejurka.com>
Date:   Mon Nov 6 05:46:29 2006 +0000

    Escaping of savepoint names in org.postgresql.jdbc3.PSQLSavepoint is
    incorrect. Backslashes in (double-quoted) savepoint names are doubled for
    escaping, but AFAIK, and as my testing shows, savepoint names are like
    identifiers, so regular identifier quoting applies to them.
    
    Michael Paesold
---
 org/postgresql/jdbc3/PSQLSavepoint.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/org/postgresql/jdbc3/PSQLSavepoint.java b/org/postgresql/jdbc3/PSQLSavepoint.java
index d064cf8..3da78d4 100644
--- a/org/postgresql/jdbc3/PSQLSavepoint.java
+++ b/org/postgresql/jdbc3/PSQLSavepoint.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/jdbc3/PSQLSavepoint.java,v 1.6 2005/01/14 01:20:21 oliver Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc3/PSQLSavepoint.java,v 1.7 2005/01/15 07:53:03 oliver Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -70,18 +70,18 @@ public class PSQLSavepoint implements Savepoint {
         if (_isNamed)
         {
             // We need to quote and escape the name in case it
-            // contains spaces/quotes/backslashes.
+            // contains spaces/quotes/etc.
             //
             StringBuffer sb = new StringBuffer(_name.length() + 2);
-            sb.append("\"");
+            sb.append('"');
             for (int i = 0; i < _name.length(); i++)
             {
                 char c = _name.charAt(i);
-                if (c == '\\' || c == '"')
+                if (c == '"')
                     sb.append(c);
                 sb.append(c);
             }
-            sb.append("\"");
+            sb.append('"');
             return sb.toString();
         }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list