can"t create tables with a $

can"t create tables with a $

am 29.09.2005 16:37:19 von uemmme

------=_Part_5245_27827331.1128004639713
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version
1.46 with DBD::Pg version 1.32.
i can create tables from psql with an $ in the middle of it, e.g. "create
table foo$bar (id integer);"
But if i try to do this
$dbh->do("create table foo\$bar (id integer);");
in a script, then following error is emiited:
DBD::Pg::db do failed: Execute called with an unbound placeholder

So i want to know, is it a bug or intended for portability?

thanks

------=_Part_5245_27827331.1128004639713--

Re: can"t create tables with a $

am 29.09.2005 16:52:07 von mlists

moma wrote:
> Hi,

Hello,

> i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version
> 1.46 with DBD::Pg version 1.32.
> i can create tables from psql with an $ in the middle of it, e.g. "create
> table foo$bar (id integer);"

That seems like a bad bad bad bad idea because how can you tell how Perl
will take the $ at any point in the flow. Or what about later when any
language/system that uses $ for special purposes uses your name. Will it
take it as a literal $ or for whatever it uses $ for. I'd rethink your
db naming shema.

> But if i try to do this
> $dbh->do("create table foo\$bar (id integer);");

$dbh->do('create table foo$bar (id integer)');

> in a script, then following error is emiited:
> DBD::Pg::db do failed: Execute called with an unbound placeholder

google "Execute called with an unbound placeholder"

Re: can"t create tables with a $

am 29.09.2005 17:01:23 von csandeep

Hi,

You should escape the $. For eg, this prints $ literally:
perl -e 'print "\$";'

so you could do "create table foo\$bar (id integer);"

This has got nothing to with dbi.

- Sandeep

On Thu, 2005-09-29 at 16:37 +0200, moma wrote:
> Hi,
>
> i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version
> 1.46 with DBD::Pg version 1.32.
> i can create tables from psql with an $ in the middle of it, e.g. "create
> table foo$bar (id integer);"
> But if i try to do this
> $dbh->do("create table foo\$bar (id integer);");
> in a script, then following error is emiited:
> DBD::Pg::db do failed: Execute called with an unbound placeholder
>
> So i want to know, is it a bug or intended for portability?
>
> thanks

RE: can"t create tables with a $

am 29.09.2005 17:12:02 von rjk-dbi

Sandeep Chayapathi [mailto:csandeep@cybernetsoft.com] wrote:
>
> You should escape the $. For eg, this prints $ literally:
> perl -e 'print "\$";'
>
> so you could do "create table foo\$bar (id integer);"

That *is* what he tried to do:

> > But if i try to do this
> > $dbh->do("create table foo\$bar (id integer);");
> > in a script, then following error is emiited:
> > DBD::Pg::db do failed: Execute called with an unbound placeholder


Ronald

RE: can"t create tables with a $

am 29.09.2005 17:17:04 von csandeep

oops! Muy Bad! I need more coffee :)

Sorry, I have no solution for this.

- Sandeep

On Thu, 2005-09-29 at 11:12 -0400, Ronald J Kimball wrote:
> Sandeep Chayapathi [mailto:csandeep@cybernetsoft.com] wrote:
> >
> > You should escape the $. For eg, this prints $ literally:
> > perl -e 'print "\$";'
> >
> > so you could do "create table foo\$bar (id integer);"
>
> That *is* what he tried to do:
>
> > > But if i try to do this
> > > $dbh->do("create table foo\$bar (id integer);");
> > > in a script, then following error is emiited:
> > > DBD::Pg::db do failed: Execute called with an unbound placeholder
>
>
> Ronald
>
>
>

Re: can"t create tables with a $

am 29.09.2005 17:20:29 von Rich

moma wrote:
> Hi,
>
> i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version
> 1.46 with DBD::Pg version 1.32.
> i can create tables from psql with an $ in the middle of it, e.g. "create
> table foo$bar (id integer);"
> But if i try to do this
> $dbh->do("create table foo\$bar (id integer);");
> in a script, then following error is emiited:
> DBD::Pg::db do failed: Execute called with an unbound placeholder
>
> So i want to know, is it a bug or intended for portability?
>
> thanks
>

i believe this is the DBD::Pg driver interpreting the $ as a
placeholder. i think you can surpress placeholder parsing with the
pg_direct attribute eg

$dbh->do("create table foo\$bar (id integer)", { pg_direct => 1} );

although i think this is only available in the latest versions of DBD::Pg.

--

- Rich Doughty

Re: can"t create tables with a $

am 29.09.2005 17:35:42 von Rich

moma wrote:
>>
>>i believe this is the DBD::Pg driver interpreting the $ as a
>>placeholder. i think you can surpress placeholder parsing with the
>>pg_direct attribute eg
>>
>>$dbh->do("create table foo\$bar (id integer)", { pg_direct => 1} );
>>
>>although i think this is only available in the latest versions of DBD::Pg.
>>
>>
>
> Thank you very much for the answer, with my version of DBD::Pg, that is 1.32,
> your solution doesn't work, but i will test it with the newest version, as
> soon as i will get it.
>
> Maybe one more question, is this behaviour intended or is it a bug?

i don't know i'm afraid. you'd get a better reply on the DBD::Pg list
(dbdpg-general@gborg.postgresql.org)


--

- Rich Doughty

Re: can`t create tables with a $

am 30.09.2005 02:29:52 von Greg

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> i am using postgresql 7.4.7 on an ubuntu box, perl 5.8.4 and DBI version
> 1.46 with DBD::Pg version 1.32.
....
> $dbh->do("create table foo\$bar (id integer);");
....
> DBD::Pg::db do failed: Execute called with an unbound placeholder

> So i want to know, is it a bug or intended for portability?

Bug. Grab any version of DBD::Pg newer than 1.32 and it should work fine.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200509292028
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B90 6714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFDPIbjvJuQZxSWSsgRAoAtAKDV1/HaMas8alHxxjV42wTB7AJVNwCe JXmj
YGqTuZSbJlxRwM4A41M2OiU=
=FhYw
-----END PGP SIGNATURE-----