Thread: Strange parse error??
I am trying to do a simple update (or at least I thought it was simple), but I just keep getting a parse error, saying: Error executing query Update "Config" Set "Wave" = 'F:\wav\BTJ.wav',"Answer" = 20, "Recordwav" ='F:\wav\',"CalledID" = '12345678' where "Recno" = 1 PostgreSQL error message: ERROR: parser: parse error at or near "12345678" PostgreSQL status:PGRES_FATAL_ERROR Does anyone have any suggestions to what might be wrong? Regards, BTJ ------------------------------------------------------------------------------- Bjørn T Johansen bjorntj@softinn.no ------------------------------------------------------------------------------- "The stickers on the side of the box said "Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better", so clearly Linux was a supported platform."
On Thu, 22 Feb 2001, [ISO-8859-1] Bj�rn T Johansen wrote: > I am trying to do a simple update (or at least I thought it was > simple), but I just keep getting a parse error, saying: > > Error executing query > > Update "Config" Set "Wave" = 'F:\wav\BTJ.wav',"Answer" = 20, > "Recordwav" ='F:\wav\',"CalledID" = '12345678' where "Recno" = 1 > > PostgreSQL error message: > ERROR: parser: parse error at or near "12345678" I believe that it's because postgres treats \ as an escape character so the 'F:\wav\' was probably treating the closing \' as an escaped quote inside the string. You'll probably want to double the \ characters.
On Thu, Feb 22, 2001 at 11:49:30PM +0100, Bjørn T Johansen wrote: > I am trying to do a simple update (or at least I thought it was > simple), but I just keep getting a parse error, saying: > > Error executing query > > Update "Config" Set "Wave" = 'F:\wav\BTJ.wav',"Answer" = 20, > "Recordwav" ='F:\wav\',"CalledID" = '12345678' where "Recno" = 1 > > PostgreSQL error message: > ERROR: parser: parse error at or near "12345678" Backslashes are used for quoting, so what you're trying to do looks something like this to the server: Update "Config" Set "Wave" = 'F:wavBTJ.wav',"Answer" = 20,"Recordwav" ='F:wav\',"CalledID" = '12345678' where "Recno" = 1 You could confirm by turning up debugging on the server and check the logs. So, it's trying to store the string : F:wav',"CalledID" = (with trailing space, even) in Recordwav. Try doubling your backslashes, as so: Update "Config" Set "Wave" = 'F:\\wav\\BTJ.wav',"Answer" = 20, "Recordwav" ='F:\\wav\\',"CalledID" = '12345678' where "Recno" = 1 Ross