X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 955BCD1E128 for ; Thu, 26 Feb 2004 15:58:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79739-07 for ; Thu, 26 Feb 2004 11:58:31 -0400 (AST) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 24107D1E0D2 for ; Thu, 26 Feb 2004 11:58:26 -0400 (AST) Received: (qmail 19767 invoked by uid 0); 26 Feb 2004 15:58:29 -0000 Received: from 81.223.25.242 by www35.gmx.net with HTTP; Thu, 26 Feb 2004 16:58:28 +0100 (MET) Date: Thu, 26 Feb 2004 16:58:28 +0100 (MET) From: "Leo Leo" To: pgsql-sql@postgresql.org MIME-Version: 1.0 Subject: a few Questions about quoted varaibles in psql X-Priority: 3 (Normal) X-Authenticated: #16679250 Message-ID: <9042.1077811108@www35.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/368 X-Sequence-Number: 17058 Hi! How can I interpret a variable in psql, when the variable has to be quoted? for example: \set myVar myValue \echo :myVar The Result ist then "myValue" ==> ok But: in my case the variable-values have to be in quotes: \set db_username myUsername \set db_password myPassword CREATE USER :db_username WITH PASSWORD :db_password ==> This will not work, because you need quotes CREATE USER :db_username WITH PASSWORD ':db_password' ==> This will create the user with Password :db_password and not myPassword (so it takes the name of the varibale and not den value) I played a bit with excaping, but even '\'':db_password'\'' will not work What can I do, in order to achieve, that psql interprets a variable in quotes? Another Problem: ================ How can I concatenate a variable with a string without having a space in between? \set foo bar \echo :foo test ==> bar test (but there is a space in between) \echo :foo||test ==> this does not work (I want bartest) Is it somehow possible to do this? Thanks for your help! Leo -- GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...) jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++