Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2yUV-0001lI-Co for pgsql-general@arkaria.postgresql.org; Wed, 28 Aug 2019 14:00:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2yUU-0008CQ-4W for pgsql-general@arkaria.postgresql.org; Wed, 28 Aug 2019 14:00:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2yUS-0008B5-5q for pgsql-general@lists.postgresql.org; Wed, 28 Aug 2019 14:00:01 +0000 Received: from [66.111.4.27] (helo=out3-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i2yUP-0000rv-C7 for pgsql-general@postgresql.org; Wed, 28 Aug 2019 13:59:59 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6AFA320B25; Wed, 28 Aug 2019 09:59:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 28 Aug 2019 09:59:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=4 XfcMD0eMQ4se32n/JNYarsUF+iJ7Vcw9bgvey91P90=; b=e5JiN+7AoJLfcSwj7 TxOshLlDHt3dsu/10jdf7gYtfxzyS8Ran7oRUhHDToGBUW+eAzFN7BHjmHNvaEiF Fg6Vaz/Szi1X7PrXa4NRM9eYXjeg1ZSyEaSsI9/fceTehvvF5sj03BNQi6o3XX3P Bf7Mk85Ncdw29kVhmTC1jmTEo9R6PDxUioqv6Y89WA5u9Nk3IVTPMVj1fc7j3JQy Lna/+/I3KWfeoZwA+sxM92CxYavI8y4Qe0lfJFxPlNtocO24B/fdd9jhc7l/L8PN lFIeJHFZdmKu2R4YbV5xElKCQVj+vbhG8OQzVUIIoH1wo9kxu8yQxByQrGf7Y3sT jehIg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=4XfcMD0eMQ4se32n/JNYarsUF+iJ7Vcw9bgvey91P 90=; b=dGXRe5wLU9MecQPmzgj3hrWXRGZjeFx1WkneKy3xiiq0EXMJ0DL/0AE7D LiOUcsXS7KuBlV8Dn2hSswxdV5bZKJhSBMPxoIGWDp9EzovoX9wN0HLzCGuO5f+s qPajj+sJy7K10T+7qr8YDiV7br+InUJR3YMOgg4SjF8AVvtvyPqFYunKgNrCtS1P isGMpKwOaNlAQetN2IbBqnikPXRwBOfQxobtpFHpQ/O7R+UiLgsELVZSfEsH8HV/ OQV3DjvPavC/KF75Sps4nzwBeqeuVbwwBSYUSMmXAXICW/Y+d3WARhCGtbKd39Di RNok7FFKNiJrjDN7KximGnK13T0ow== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeitddgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjedurddvuddvrdduhedtrddvtddvnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsth gvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 24E098006B; Wed, 28 Aug 2019 09:59:45 -0400 (EDT) Subject: Re: Question about password character in ECPG's connection string To: "Egashira, Yusuke" , 'Giuseppe Sacco' , "pgsql-general@postgresql.org" References: <848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02> <848B1649C8A6274AA527C4472CA11EDD5FC76A28@G01JPEXMBYT02> From: Adrian Klaver Message-ID: Date: Wed, 28 Aug 2019 06:59:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <848B1649C8A6274AA527C4472CA11EDD5FC76A28@G01JPEXMBYT02> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.27 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/27/19 6:18 PM, Egashira, Yusuke wrote: > Hi, Giuseppe, > > Thanks to response to my question! > >> It seems to me that ECPG documentation does not allow specifying >> username and/or password in the connection string. The correct syntax >> should be: >> >> EXEC SQL CONNECT TO "unix:postgresql://localhost/connectdb" USER >> "myuser" IDENTIFIED BY "pass&word" > > Yes, I could connect to database with "USER" and "IDENTIFIED BY" phrase in CONNECT statement. > However, I could also connect to database with password in connection string when my password does not contains '&' character. > > 1. In database, > > CREATE ROLE myuser LOGIN PASSWORD 'password'; > 2. In ECPG application, > EXEC SQL CONNECT "tcp:postgresql://localhost?user=myuser&password=password"; > -> The connection was succeeded. > > This behavior confuse me. My guess it that what is happening is: 1) Given password: my&pwd 2) "tcp:postgresql://localhost?user=myuser&password=password" looks like "tcp:postgresql://localhost?user=myuser&password=my&pwd" and password is parsed on the & and you also end up with an extra parameter pwd Have you tried quoting the password? > > If user and password cannot write in connection string, what are parameters allowed in "connection_option" ? > I hope I can get this information from the ECPG documentation. > > Regards. > > -- > Yusuke, Egashira. > -- Adrian Klaver adrian.klaver@aklaver.com