A strange SQL grammar issue with postgreSql 8.4.4 & Hibernate 3.5 - Mailing list pgsql-general

From Sheng Hui
Subject A strange SQL grammar issue with postgreSql 8.4.4 & Hibernate 3.5
Date
Msg-id SNT121-W64C23B7F39C23199454DED854A0@phx.gbl
Whole thread Raw
Responses Re: A strange SQL grammar issue with postgreSql 8.4.4 & Hibernate 3.5  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

This is the sql statement that causes the problem in Hibernate. It's actually generated by Hibernate.

select this_.ENTITY_ID as ENTITY1_54_0_, this_.objecthandle_id as objectha2_54_0_, this_.remoteId as remoteId55_0_, this_.MANAGEMENTSERVER_ID as MANAGEME2_55_0_, this_.configFile as configFile66_0_, this_.runtimeGUID as runtimeG2_66_0_, this_.name as name66_0_, this_.runtimeGuestOS as runtimeG4_66_0_, this_.configGuestOS as configGu5_66_0_, this_.configGuestId as configGu6_66_0_, this_.numCPU as numCPU66_0_, this_.numNIC as numNIC66_0_, this_.memory as memory66_0_, this_.cpuReservation as cpuRese10_66_0_, this_.cpuLimit as cpuLimit66_0_, this_.cpuShares as cpuShares66_0_, this_.cpuSharesLevel as cpuShar13_66_0_, this_.memReservation as memRese14_66_0_, this_.memLimit as memLimit66_0_, this_.memShares as memShares66_0_, this_.memSharesLevel as memShar17_66_0_, this_.diskSpaceConsumed as diskSpa18_66_0_, this_.diskSpaceScanned as diskSpa19_66_0_, this_.diskSpaceCommitted as diskSpa20_66_0_, this_.toolStatus as toolStatus66_0_, this_.toolVersion as toolVer22_66_0_, this_.ipAddress as ipAddress66_0_, this_.dnsName as dnsName66_0_, this_.state as state66_0_, this_.connectionState as connect26_66_0_, this_.expiryState as expiryS27_66_0_, this_.printEmbedded as printEm28_66_0_, this_.existsInInventory as existsI29_66_0_, this_.existsOnDiskEnum as existsO30_66_0_, this_.customizableOS as customi31_66_0_, this_.PARENTFOLDER_ID as PARENTF32_66_0_, this_.RUNTIMESERVER_ID as RUNTIME33_66_0_, this_.RESOURCEPOOL_ID as RESOURC34_66_0_, this_.DSBACKING_ID as DSBACKING35_66_0_, this_.DATACENTER_ID as DATACENTER36_66_0_, this_.CLUSTER_ID as CLUSTER37_66_0_, this_.installedOs as install38_66_0_, this_.lastScanDate as lastSca39_66_0_, this_.lastLoginScanDate as lastLog40_66_0_, this_.poweredOffSince as powered41_66_0_, this_.lastLogonTime as lastLog42_66_0_, this_.lastLogonUser as lastLog43_66_0_, this_.containerSpaceUsed as contain44_66_0_, this_.logicalDiskSize as logical45_66_0_, this_.freeDiskSpace as freeDis46_66_0_, this_.freeDiskSpacePercent as freeDis47_66_0_, this_.cost as cost66_0_, this_.snapshots as snapshots66_0_, this_.earliestSnapshotDate as earlies50_66_0_, this_.earliestSnapshotName as earlies51_66_0_, this_.lastDatastoreScanDate as lastDat52_66_0_, this_.diskStorageTypeEnum as diskSto53_66_0_, this_.connectedMedia as connect54_66_0_, this_.compliant as compliant66_0_, this_.complianceIssue as complia56_66_0_, this_.nonCompliantTime as nonComp57_66_0_, (SELECT this_.cost/ 4 ) as formula4_0_, (SELECT this_.cost / 12 ) as formula5_0_ from INV_DEPLOYEDIMAGES this_ where (lower(this_.configGuestId) like ? escape '\')

The last statement I traced up to is the executeQuery() in an NewProxyPreparedStatement  instance (I use C3P0 connection pool with Hibernate),
the exception from this statement is

JDBCExceptionReporter - ERROR: unterminated quoted string at or near "'\')"

The unwrapped SQL exception is pretty much the same, complaining about the escape '\' at the end of the statement.

But if I use plain JDBC to connect to the same database, and run the same query, it's all fine!

Please help.
 

pgsql-general by date:

Previous
From: Reid Thompson
Date:
Subject: Group by and limit
Next
From: zhong ming wu
Date:
Subject: use wal archiving scheme from 8.1 on 9.0