Skip site navigation (1) Skip section navigation (2)

PQescapeByteaConn - returns wrong string for PG9.1 Beta3

From: "Petro Meier" <Petro85(at)gmx(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: PQescapeByteaConn - returns wrong string for PG9.1 Beta3
Date: 2011-08-03 13:19:06
Message-ID: 20110803131906.116290@gmx.net (view raw or flat)
Thread:
Lists: pgsql-hackers
Normal        0                        21                        false      
  false        false                DE        X-NONE        X-NONE          
                                                                            
                          MicrosoftInternetExplorer4                        
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                

Please let me clarify the bug:        

         CREATE TABLE "testtable"        

(        

  "ID" integer NOT NULL,        

  "BinaryContents" bytea        

);        

         INSERT INTO "testtable" ("ID", "BinaryContents") values (1, 
E'\xea2abd8ef3');        

         returns "invalid byte sequence".         

         '\xea2abd8ef3' is the string delivered by the PG 9.1 Beta3 server 
when calling PQescapeByteaConn(). It cannot be further processed by the 
server itself afterwards! There is a leading '\' missing.         

         When calling the function for a PG 9.0.1 server, then the result 
(correctly) is '\\xea2abd8ef3' (with a double-backslash!), and then the 
insert works fine, both, with PG9.1 Beta3 and PG9.0.1        

         It is a serious issue, as it will break all existing PostgreSQL 
applications that deal with binary contents and use PQescapeByteaConn().    
    

         Best regards        

Petro    
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-08-03 13:29:54
Subject: Re: pgbench internal contention
Previous:From: Robert HaasDate: 2011-08-03 12:59:47
Subject: Re: WIP: Fast GiST index build

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group