Re: perl dbi postgresql uppercase problem

Поиск
Список
Период
Сортировка
От Arguile
Тема Re: perl dbi postgresql uppercase problem
Дата
Msg-id LLENKEMIODLDJNHBEFBOIEGLEGAA.arguile@lucentstudios.com
обсуждение исходный текст
Ответ на perl dbi postgresql uppercase problem  (Marco Kienzle <M.Kienzle@marlab.ac.uk>)
Список pgsql-interfaces
Marco Kienzle wrote:
>
> 1.    first, is it possible to store the query in a file and invoke its
> execution from perl (\i file.sql command from     Postgresql) ?

Just slurp in the textfile and $dbh->do() it.

> 2.    second, I want to use PERL variables in an SQL query (for example
> $var='R') but if I use them in the query, the Postgresql server return the
> following error: Attribute 'r' not found ...  I did not ask for 'r'
> attribute but for 'R'. Does any one know how to resolve this
> uppercase/lowercase problem ?

You're encountering case folding. PostgreSQL lower()s all non-quoted
attributes.
SELECT  FOO  FROM table;SELECT  Foo  FROM table;SELECT  foo  FROM table;SELECT "foo" FROM table;

These all use attribute "foo".
SELECT "Foo" FROM table;

This uses attribute "Foo".

Search the archives if you'd like to know standard ways people handle this
and the rational behind it. For using variables in the value side of any
query look up placeholders if you're not already familiar with them.




В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Marco Kienzle
Дата:
Сообщение: perl dbi postgresql uppercase problem
Следующее
От: "Jeroen T. Vermeulen"
Дата:
Сообщение: libpqxx milestone