Hi Ben,

Have a read of the following Postgres documentation 
(http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html).

The behavior of escapes in strings has changed in 9.1. Note the warning 
generated for the 8.4 run. If you alter the string as suggested by the 8.4 run 
then this will fix the 9.1 run also.

The change in behavior of escape string has been on the table for awhile.

Brett

Sent from my iPad

On 08/10/2012, at 7:33 PM, "Ben Caradoc-Davies (JIRA)" 
<[email protected]<mailto:[email protected]>> wrote:

[http://www.codehaus.org/codehaus-small.gif]
[https://jira.codehaus.org/secure/useravatar?avatarId=10232]
Ben 
Caradoc-Davies<https://jira.codehaus.org/secure/ViewProfile.jspa?name=bencaradocdavies>
 created [https://jira.codehaus.org/images/icons/bug.gif]  
GEOT-4280<https://jira.codehaus.org/browse/GEOT-4280>
Build failure in gt-jdbc-postgis PostgisUDTTest with PostgreSQL 
9.1<https://jira.codehaus.org/browse/GEOT-4280>



Issue Type:     [https://jira.codehaus.org/images/icons/bug.gif]  Bug
Affects Versions:       9.0-M0
Assignee:       Justin 
Deoliveira<https://jira.codehaus.org/secure/ViewProfile.jspa?name=jdeolive>
Components:     jdbc-postgis plugin
Created:        08/Oct/12 3:31 AM
Description:

org.geotools.data.postgis.ps.PostgisUDTTest passes with PostgreSQL 8.4 but 
fails with PostgreSQL 9.1:

-------------------------------------------------------------------------------
Test set: org.geotools.data.postgis.ps.PostgisUDTTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.565 sec <<< 
FAILURE!
testSchema(org.geotools.data.postgis.ps.PostgisUDTTest)  Time elapsed: 0.197 
sec  <<< ERROR!
java.lang.NullPointerException
        at org.geotools.jdbc.JDBCUDTTest.testSchema(JDBCUDTTest.java:38)
[...]
testRead(org.geotools.data.postgis.ps.PostgisUDTTest)  Time elapsed: 0.165 sec  
<<< ERROR!
java.lang.NullPointerException
        at org.geotools.jdbc.JDBCUDTTest.testRead(JDBCUDTTest.java:46)
[...]
testWrite(org.geotools.data.postgis.ps.PostgisUDTTest)  Time elapsed: 0.168 sec 
 <<< ERROR!
java.lang.NullPointerException


The failure, which occurs during the fixture setup, can be seen in Eclipse:

org.postgresql.util.PSQLException: ERROR: value for domain foo violates check 
constraint "foo_check"
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:345)
        at 
org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
        at 
org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
        at 
org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
        at org.geotools.jdbc.JDBCTestSetup.run(JDBCTestSetup.java:162)
        at org.geotools.jdbc.JDBCTestSetup.run(JDBCTestSetup.java:127)
        at 
org.geotools.data.postgis.PostgisUDTTestSetup.createUdtTable(PostgisUDTTestSetup.java:51)
        at 
org.geotools.jdbc.JDBCUDTTestSetup.setUpData(JDBCUDTTestSetup.java:37)
        at org.geotools.jdbc.JDBCTestSupport.connect(JDBCTestSupport.java:131)
        at org.geotools.test.OnlineTestCase.setUp(OnlineTestCase.java:243)
        at junit.framework.TestCase.runBare(TestCase.java:132)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at org.geotools.test.OnlineTestCase.run(OnlineTestCase.java:123)


Here is a simplified example to demonstrate:

create domain demo_foo as text check (value ~ '\\d{2}\\D{2}');
create table demo_udt (id integer primary key, ut demo_foo);
insert into demo_udt values (0, '12ab');
select * from demo_udt;

drop table demo_udt;
drop domain demo_foo;


Succeeds on PostgreSQL 8.4.13:

$ psql -h localhost -d jenkins -U jenkins -W
Password for user jenkins:
psql (8.4.13)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

jenkins=> create domain demo_foo as text check (value ~ '\\d{2}\\D{2}');
WARNING:  nonstandard use of \\ in a string literal
LINE 1: create domain demo_foo as text check (value ~ '\\d{2}\\D{2}'...
                                                      ^
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
CREATE DOMAIN
jenkins=> create table demo_udt (id integer primary key, ut demo_foo);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "demo_udt_pkey" 
for table "demo_udt"
CREATE TABLE
jenkins=> insert into demo_udt values (0, '12ab');
INSERT 0 1
jenkins=> select * from demo_udt;
 id |  ut
----+------
  0 | 12ab
(1 row)

jenkins=> drop table demo_udt;
DROP TABLE
jenkins=> drop domain demo_foo;
DROP DOMAIN


The same SQL fails on PostgreSQL 9.1:

$ psql -h localhost -d test -U test -W
Password for user test:
psql (9.1.6)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

test=> create domain demo_foo as text check (value ~ '\\d{2}\\D{2}');
CREATE DOMAIN
test=> create table demo_udt (id integer primary key, ut demo_foo);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "demo_udt_pkey" 
for table "demo_udt"
CREATE TABLE
test=> insert into demo_udt values (0, '12ab');
ERROR:  value for domain demo_foo violates check constraint "demo_foo_check"
test=> select * from demo_udt;
 id | ut
----+----
(0 rows)

test=> drop table demo_udt;
DROP TABLE
test=> drop domain demo_foo;
DROP DOMAIN



Environment:    Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: /home/car605/junk/java/maven3
Java version: 1.6.0_34, vendor: Sun Microsystems Inc.
Java home: /home/car605/junk/java/jdk1.6.0_34.x64/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"

postgresql-9.1 9.1.6-1 amd64
postgresql-9.1-postgis 1.5.3-2 amd64
Project:        GeoTools<https://jira.codehaus.org/browse/GEOT>
Priority:       [https://jira.codehaus.org/images/icons/priority_critical.gif]  
Critical
Reporter:       Ben 
Caradoc-Davies<https://jira.codehaus.org/secure/ViewProfile.jspa?name=bencaradocdavies>



This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA 
administrators<https://jira.codehaus.org/secure/ContactAdministrators!default.jspa>.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
GeoTools-Devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geotools-devel
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to