Re: bytea insert difference between 8.3 and 9.x

Поиск
Список
Период
Сортировка
От Gregg Jaskiewicz
Тема Re: bytea insert difference between 8.3 and 9.x
Дата
Msg-id CAJY59_jNqb6jU59L3Q=PGB76FZJgmDj2=bOx1xYDe46S_5WE-g@mail.gmail.com
обсуждение исходный текст
Ответ на bytea insert difference between 8.3 and 9.x  (Gregg Jaskiewicz <gryzman@gmail.com>)
Ответы Re: bytea insert difference between 8.3 and 9.x
Список pgsql-general
On 26 September 2011 14:39, Merlin Moncure <mmoncure@gmail.com> wrote:

> urk -- I have to be honest -- that's a pretty lousy way to send bytea.
> Personally, I'd encode the string as hex and send it like this:
>
> "INSERT INTO foo(x) VALUES( decode('" + hex_string + "'))";
>
> libpqxx doesn't have the ability to parameterize queries?
>

Thanks Merin.

It does, and that's probably what I'll do. Your solution isn't great
either, because it requires extra function to be run on the postgresql
side. Me no likeey that ;)
When you say parameterized - it allows you to prepare queries - which
I do in 80% of select/insert/update cases, apart from some older code
that no one wants to touch.
But the time came for me to act on it, and try to put us forward using
9.1 instead of old rusty 8.3 (which is still better then 8.1 they used
before I started working here).

m_connection.prepare("INSERT INTO foo(x) VALUES($1)") ("bytea",
pqxx::prepare::treat_binary);

Gotta try that one with both boys ;)

Btw, I hope 9.1.1 is out soon, gotta package some version for tests.
We used floating point timestamps, and I gotta repackage centos rpms
with that config option - otherwise it's pg_dump and restore of gigs
of data....


--
GJ

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

Предыдущее
От: "Albe Laurenz"
Дата:
Сообщение: Re: changing from postgreSQL 8.3 to 9.0
Следующее
От: Jov
Дата:
Сообщение: Pg and compress