[SQL] with queries

2010-09-15 Thread Greg Quinn
Forget my previous post. I am stupid. It doesn't work with 8.3.7, sorry to trouble you. -- Greg Quinn Australian Phenomics Facility greg.qu...@anu.edu.au (02) 61259407 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.o

[SQL] with queries

2010-09-15 Thread Greg Quinn
Hullo. I've been a Postgresql user for many years, so forgive me if I'm doing something really stupid. I cannot get 'with' queries to work at all. The test query that I've entered below (as an example) is direct from the section '7.8 WITH Queries' of the manual, so I'd expect that to work wo

Re: [SQL] Use "CREATE USER" in plpgsql function - Found word(s) list error in the Text body

2010-09-15 Thread Tatarnikov Alexander
Finally i'm using: EXECUTE 'CREATE USER '|| quote_ident(creds."userName") ||' WITH PASSWORD '|| quote_literal(creds."userPassword") || ' IN GROUP ta_users'; and it works perfect. Thanks! 2010/9/16 Igor Neyman > > > -- > *From:* Asko Oja [mailto:asc...@gmail.com]

Re: [SQL] Use "CREATE USER" in plpgsql function - Found word(s) list error in the Text body

2010-09-15 Thread Igor Neyman
From: Asko Oja [mailto:asc...@gmail.com] Sent: Wednesday, September 15, 2010 2:29 PM To: Igor Neyman Cc: Tatarnikov Alexander; pgsql-sql@postgresql.org Subject: Re: [SQL] Use "CREATE USER" in plpgsql function - Found wor

Re: [SQL] Use "CREATE USER" in plpgsql function - Found word(s) list error in the Text body

2010-09-15 Thread Igor Neyman
> -Original Message- > From: Asko Oja [mailto:asc...@gmail.com] > Sent: Wednesday, September 15, 2010 2:29 PM > To: Igor Neyman > Cc: Tatarnikov Alexander; pgsql-sql@postgresql.org > Subject: Re: [SQL] Use "CREATE USER" in plpgsql function - > Found word(s) list error in the Text body >

Re: [SQL] Use "CREATE USER" in plpgsql function

2010-09-15 Thread Asko Oja
And dynamic SQL leads easily to SQL injection so quoting is required there. execute 'create user ' || quote_ident(i_username) || ' password ' || quote_literal(i_password); On Wed, Sep 15, 2010 at 5:26 PM, Igor Neyman wrote: > > > > -Original Message- > > From: Tatarnikov Alexand

Re: [SQL] Use "CREATE USER" in plpgsql function

2010-09-15 Thread Igor Neyman
> -Original Message- > From: Tatarnikov Alexander [mailto:cank...@gmail.com] > Sent: Wednesday, September 15, 2010 12:05 AM > To: pgsql-sql@postgresql.org > Subject: Use "CREATE USER" in plpgsql function > > Hello! > > I have function wich check user credentials and if test > passed

Re: [SQL] Use "CREATE USER" in plpgsql function

2010-09-15 Thread Sergey Konoplev
2010/9/15 Tatarnikov Alexander : > Thanks for response! > > Here is function > >     CREATE USER creds."userName" WITH PASSWORD creds."userPassword" > IN GROUP ta_users; - there is error occured You can not use variables for non-data entities. Use the dynamic SQL instead: EXECUTE 'CREATE