BUG #3363: Unable to load a plugin/library using -c switch to the psql

Started by Gurjeet Singhalmost 19 years ago5 messagesbugs
Jump to latest
#1Gurjeet Singh
singh.gurjeet@gmail.com

The following bug has been logged online:

Bug reference: 3363
Logged by: Gurjeet Singh
Email address: singh.gurjeet@gmail.com
PostgreSQL version: 8.3devel
Operating system: Windows
Description: Unable to load a plugin/library using -c switch to the
psql
Details:

The following command fails:

psql postgres test -X -c "load '$libdir/plugins/index_adviser.dll';"

Here, 'test' user (non-superuser) is trying to connect to 'postgres'
database, and wishes to load a plugin as the first step.

But if the same 'load' command is fired by the same user after log-in
using psql, then the command succeeds.

postgres=> load '$libdir/plugins/index_adviser.dll';
NOTICE: IND ADV: Loaded; PID: 1164
LOAD
postgres=>

#2Douglas Toltzman
doug@oakstreetsoftware.com
In reply to: Gurjeet Singh (#1)
Re: BUG #3363: Unable to load a plugin/library using -c switch to the psql

I've not done what you're doing, so this is just a suggestion. I'm
not sure about the Windows shell, but the bash shell will convert
$libdir before handing it off to psql. Is it possible that $libdir
has a different meaning in psql than it does to the shell?

On Jun 5, 2007, at 4:20 PM, Gurjeet Singh wrote:

The following bug has been logged online:

Bug reference: 3363
Logged by: Gurjeet Singh
Email address: singh.gurjeet@gmail.com
PostgreSQL version: 8.3devel
Operating system: Windows
Description: Unable to load a plugin/library using -c switch
to the
psql
Details:

The following command fails:

psql postgres test -X -c "load '$libdir/plugins/index_adviser.dll';"

Here, 'test' user (non-superuser) is trying to connect to
'postgres'
database, and wishes to load a plugin as the first step.

But if the same 'load' command is fired by the same user after
log-in
using psql, then the command succeeds.

postgres=> load '$libdir/plugins/index_adviser.dll';
NOTICE: IND ADV: Loaded; PID: 1164
LOAD
postgres=>

---------------------------(end of
broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Gurjeet Singh (#1)
Re: BUG #3363: Unable to load a plugin/library using -c switch to the psql

"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:

The following command fails:

psql postgres test -X -c "load '$libdir/plugins/index_adviser.dll';"

Define "fails". I get complaints about the arguments being out of
order, which they are ...

Here, 'test' user (non-superuser) is trying to connect to 'postgres'
database, and wishes to load a plugin as the first step.

If you think that -c means "run this command and then go into normal
interactive mode", you're wrong anyway.

regards, tom lane

#4Gurjeet Singh
singh.gurjeet@gmail.com
In reply to: Douglas Toltzman (#2)
Re: BUG #3363: Unable to load a plugin/library using -c switch to the psql

On 6/5/07, Douglas Toltzman <doug@oakstreetsoftware.com> wrote:

I'm not sure about the Windows shell, but the bash shell will convert
$libdir before handing it off to psql.

I am actually using MinGW, so no I am not using Windows shell but a bash
shell compiled for Windows.

Yes, it was actually the bash, interpreting the $ symbol in a special way,
hence the problem. I tried the following (notice \$ , escaping $ sign ) and
now it works...

$ psql postgres test -X -c "load '\$libdir/plugins/index_adviser.dll';"
NOTICE: IND ADV: Loaded; PID: 4968
LOAD

Had I been using the Windows shell, I wouldn't have faced this problem :)

Thanks for the pointer....

not a bug

Is it possible that $libdir has a different meaning in psql than it does to

the shell?
On Jun 5, 2007, at 4:20 PM, Gurjeet Singh wrote:

The following bug has been logged online:

Bug reference: 3363
Logged by: Gurjeet Singh
Email address: singh.gurjeet@gmail.com
PostgreSQL version: 8.3devel
Operating system: Windows
Description: Unable to load a plugin/library using -c switch to the
psql
Details:

The following command fails:

psql postgres test -X -c "load '$libdir/plugins/index_adviser.dll';"

Here, 'test' user (non-superuser) is trying to connect to 'postgres'
database, and wishes to load a plugin as the first step.

But if the same 'load' command is fired by the same user after log-in
using psql, then the command succeeds.

postgres=> load '$libdir/plugins/index_adviser.dll';
NOTICE: IND ADV: Loaded; PID: 1164
LOAD
postgres=>

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

*Douglas Toltzman*
doug@oakstreetsoftware.com
(910) 526-5938

--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

17°29'34.37"N 78°30'59.76"E - Hyderabad *
18°32'57.25"N 73°56'25.42"E - Pune

Sent from my BlackLaptop device

#5Gurjeet Singh
singh.gurjeet@gmail.com
In reply to: Tom Lane (#3)
Re: BUG #3363: Unable to load a plugin/library using -c switch to the psql

On 6/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:

The following command fails:

psql postgres test -X -c "load '$libdir/plugins/index_adviser.dll';"

Define "fails". I get complaints about the arguments being out of
order, which they are ...

(this bug is solved (not a bug) ; please refer my last mail)

I am sorry, I didn't post the error messsage; here it goes.

ERROR: access to library "/plugins/index_adviser.dll" is not allowed

Here, 'test' user (non-superuser) is trying to connect to 'postgres'

database, and wishes to load a plugin as the first step.

If you think that -c means "run this command and then go into normal
interactive mode", you're wrong anyway.

No, I do not wish to do that (I use the .psqlrc for that purpose); this is
the first command in a sequence of commands that I want psql to execute and
exit.

--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

17°29'34.37"N 78°30'59.76"E - Hyderabad *
18°32'57.25"N 73°56'25.42"E - Pune

Sent from my BlackLaptop device