X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D900F9DC8A2 for ; Wed, 18 Jan 2006 01:24:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37953-07 for ; Wed, 18 Jan 2006 01:24:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (gc4-mx.gc4.com [202.124.128.22]) by postgresql.org (Postfix) with ESMTP id 682419DC894 for ; Wed, 18 Jan 2006 01:24:39 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id k0I5O4C00123; Wed, 18 Jan 2006 13:24:04 +0800 From: "Christian Paul B. Cosinas" To: "'Michael Fuhr'" , "'Michael Glaesemann'" Cc: Subject: Re: Characters that needs escape characters when inserting to database Date: Wed, 18 Jan 2006 13:33:09 -0800 Message-ID: <026501c61c76$cffe3560$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20060117175642.GA11363@winnie.fuhr.org> Thread-Index: AcYbj2Ljah7DZNgiRaOiy7WzDEXcUgA5xPoA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.436 required=5 tests=[AWL=0.120, DATE_IN_FUTURE_12_24=2.316] X-Spam-Score: 2.436 X-Spam-Level: ** X-Archive-Number: 200601/111 X-Sequence-Number: 23900 I am using Visual Basic as the front end. I connect to postgresql database through ODBC. I encounter some error when I insert value to a field. The error is "syntax error" Which make me think that there are other characters that needs an escape chcracter. Cheers. -----Original Message----- From: Michael Fuhr [mailto:mike@fuhr.org] Sent: Tuesday, January 17, 2006 9:57 AM To: Michael Glaesemann Cc: Christian Paul B. Cosinas; pgsql-sql@postgresql.org Subject: Re: [SQL] Characters that needs escape characters when inserting to database On Tue, Jan 17, 2006 at 04:20:23PM +0900, Michael Glaesemann wrote: > On Jan 18, 2006, at 7:21 , Christian Paul B. Cosinas wrote: > >Can anyone give me a list of characters that needs to be preceded by > >an escape character before inserting to database. > > Take a look at this documentation on string constants. It should > answer the questions you have. > http://www.postgresql.org/docs/current/interactive/sql-syntax.html#SQL > -SYNTAX-STRINGS Out of curiosity, why are you asking? Unless you're implementing some low-level interface to the database you shouldn't need to worry about escaping strings; just use your API's quote/escape (or whatever) function or its placeholder mechanism (if it has one). If you're using an interface that doesn't have any of these capabilities, what is it? Some people might want to avoid it ;-) -- Michael Fuhr I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html