Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-28 Thread Pavel Stehule
2009/12/28 Robert Haas : > On Fri, Dec 25, 2009 at 3:10 PM, Robert Haas wrote: >> On Fri, Dec 25, 2009 at 2:30 PM, Tom Lane wrote: >>> Robert Haas writes: Works for me.  One small problem discussed upthread is that there currently doesn't appear to be a libpq function that does id

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-27 Thread Robert Haas
On Fri, Dec 25, 2009 at 3:10 PM, Robert Haas wrote: > On Fri, Dec 25, 2009 at 2:30 PM, Tom Lane wrote: >> Robert Haas writes: >>> Works for me.  One small problem discussed upthread is that there >>> currently doesn't appear to be a libpq function that does >>> ident-quoting.  I'm thinking that

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Robert Haas
On Fri, Dec 25, 2009 at 2:30 PM, Tom Lane wrote: > Robert Haas writes: >> Works for me.  One small problem discussed upthread is that there >> currently doesn't appear to be a libpq function that does >> ident-quoting.  I'm thinking that we will need to add one to make this >> work - is that goin

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Tom Lane
Robert Haas writes: > Works for me. One small problem discussed upthread is that there > currently doesn't appear to be a libpq function that does > ident-quoting. I'm thinking that we will need to add one to make this > work - is that going to be a problem? The rules for ident-quoting are simp

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Robert Haas
On Fri, Dec 25, 2009 at 2:12 PM, Tom Lane wrote: > Robert Haas writes: >> If we do want to go >> with a single flag character, maybe it should just be a single or >> double quote: > >> :'foo - quote as a literal >> :"foo - quote as an ident > > I would've proposed that myself if I thought it woul

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Pavel Stehule
2009/12/25 Tom Lane : > Robert Haas writes: >> If we do want to go >> with a single flag character, maybe it should just be a single or >> double quote: > >> :'foo - quote as a literal >> :"foo - quote as an ident > > I would've proposed that myself if I thought it would work, but I'm > afraid tha

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Tom Lane
Robert Haas writes: > If we do want to go > with a single flag character, maybe it should just be a single or > double quote: > :'foo - quote as a literal > :"foo - quote as an ident I would've proposed that myself if I thought it would work, but I'm afraid that it will wreak complete chaos from

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Pavel Stehule
2009/12/25 Robert Haas : > On Fri, Dec 25, 2009 at 1:41 PM, Tom Lane wrote: >> Pavel Stehule writes: >>> there are two quoting styles, so we need two syntax. I proposed >> >>> :[var] and :{var} - for ident quoting and literal quoting. >>> Theoretically we could to use :(var) for bytea escaping. >

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Robert Haas
On Fri, Dec 25, 2009 at 1:41 PM, Tom Lane wrote: > Pavel Stehule writes: >> there are two quoting styles, so we need two syntax. I proposed > >> :[var] and :{var} - for ident quoting and literal quoting. >> Theoretically we could to use :(var) for bytea escaping. > > And if you need a fourth styl

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Pavel Stehule
2009/12/25 Tom Lane : > Pavel Stehule writes: >> there are two quoting styles, so we need two syntax. I proposed > >> :[var] and :{var} - for ident quoting and literal quoting. >> Theoretically we could to use :(var) for bytea escaping. > > And if you need a fourth style, you're at a dead end.  I

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Tom Lane
Pavel Stehule writes: > there are two quoting styles, so we need two syntax. I proposed > :[var] and :{var} - for ident quoting and literal quoting. > Theoretically we could to use :(var) for bytea escaping. And if you need a fourth style, you're at a dead end. I don't think this is really an i

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Pavel Stehule
2009/12/25 Tom Lane : > Robert Haas writes: >> I think maybe what we need here is a piece of syntax to indicate that a >> specific parameter should be substituted after first being passed >> through PQescapeStringConn. > > I agree that a global flag that changes the behavior of :foo is a > serious

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Tom Lane
Robert Haas writes: > I think maybe what we need here is a piece of syntax to indicate that a > specific parameter should be substituted after first being passed > through PQescapeStringConn. I agree that a global flag that changes the behavior of :foo is a seriously bad idea. Alternate syntax w

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-25 Thread Pavel Stehule
> > This makes sense now that you've explained it.  Personally, I would > not choose to use psql as a scripting language, and I think there has The scripting are not realised directly in psql - psql missing some basic features still. Usually is used in combination with bash (any shell) - like star

Re: [HACKERS] info about patch: using parametrised query in psql

2009-12-24 Thread Robert Haas
On Thu, Dec 24, 2009 at 2:45 AM, Pavel Stehule wrote: > Hello > > I try to explain my motivation for creating this patch > https://commitfest.postgresql.org/action/patch_view?id=224 . > > Parametrised queries are supported in PostgreSQL long time. Using the > parametrised queries is point of all a

[HACKERS] info about patch: using parametrised query in psql

2009-12-24 Thread Pavel Stehule
Hello I try to explain my motivation for creating this patch https://commitfest.postgresql.org/action/patch_view?id=224 . Parametrised queries are supported in PostgreSQL long time. Using the parametrised queries is point of all advices about good programming style. On application level it is pro