Re: DML value format - Mailing list pgsql-general

From Kev
Subject Re: DML value format
Date
Msg-id 1186747639.775251.131750@x40g2000prg.googlegroups.com
Whole thread Raw
In response to [PROPOSAL] DML value format  (Alejandro Torras <atec_post@yahoo.es>)
List pgsql-general
On Aug 10, 6:56 am, atec_p...@yahoo.es (Alejandro Torras) wrote:
> -- English --
> Hi,
>
> Is there some way to put values in a INSERT statement
> without taking care of apostrophes?
>
> In example:
> INSERT INTO persons VALUES ('Harry', 'O'Callaghan');
>                                       ^^^^^^^^^^^
>
> I think that it can be used some kind of length-marker
> to help the parsing of the value.
>
> In example:
> INSERT INTO persons VALUES ('Harry', @11:O'Callaghan);
>
> I think this approach could help reducing the sql
> injections.

If you're worried about sql injections, I'm not sure what kind of
client library you're using to access your pgsql database, but most of
them should have placeholder capability, I think, which definitely
takes care of that.  Your statement would become INSERT INTO persons
VALUES (?, ?) and then you would pass the execution function your two
values and it would escape them properly for you.  At least that's how
it works with Perl and DBI.

Kev


pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: serial grows on failed requests
Next
From: "Eric Rasoa"
Date:
Subject: Postgres : Close cursor / PerformPortalClose