Re: Search content within a bytea field
От | Tom Lane |
---|---|
Тема | Re: Search content within a bytea field |
Дата | |
Msg-id | 798.1251727871@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Search content within a bytea field (Damiano Bolzoni <damiano.bolzoni@gmail.com>) |
Ответы |
Re: Search content within a bytea field
|
Список | pgsql-jdbc |
Damiano Bolzoni <damiano.bolzoni@gmail.com> writes: > But...why if I manually query with a SQL client (AquaStudio) as > follows: > SELECT myfield FROM mytable WHERE myfield LIKE '%hello%' > and 'myfield' is a bytea field I get the result I expected? The unknown-type literal is assumed to be of type bytea in this case. In general, if the parser finds "known_type_value operator unmarked_literal" then it preferentially selects an operator with both input types the same, ie, it prefers to believe the unmarked_literal is the same data type as the other input. The JDBC environment behaves differently because setString and so on do not produce unmarked literals --- there's an implicit cast to some datatype. So you have to make sure you've picked a parameter-setting function that is reasonably compatible with the intended operation. This is a good thing, really; it tends to keep the system from choosing an unexpected operation. regards, tom lane
В списке pgsql-jdbc по дате отправления: