Обсуждение: Weird query error from one of my users

Поиск
Список
Период
Сортировка

Weird query error from one of my users

От
John Scalia
Дата:
Hi all,

I have a user submitting a query involving a column that is an hstore type. The query seems to run just fine from her pgAdmin III console, but I cannot get it to run from a psql session. I've been studying the hstore page on the postgresql site but nothing there is quite like this query on that page. Here's the query:

SELECT
        a.id as sva_id,
        m.account_number_hash as account_num_hash,
        a.status as status,
        a.balance_currency as currency,
        a.balance as balance,
        'datamart_fdw_m2'::text as platform
    FROM account a
    INNER JOIN switch_mcontainer m ON (m.attributes -> 'EXTERNAL_ID')::text = a.external_id::text;

The psql error says: ERROR:  operator does not exist: public.hstore -> unknown

I don't quite understand the error as the postgresql hstore page shows the "->" as a valid operator. Anyone have any ideas? And of course, the better question is why does it run correctly in pgAdmin? Please let me know if you need the table descriptions for either the account or mcontainer or both tables.

Thanks in advance,
Jay

Re: Weird query error from one of my users

От
Tom Lane
Дата:
John Scalia <jayknowsunix@gmail.com> writes:
> The psql error says: ERROR:  operator does not exist: public.hstore ->
> unknown

> I don't quite understand the error as the postgresql hstore page shows the
> "->" as a valid operator. Anyone have any ideas? And of course, the better
> question is why does it run correctly in pgAdmin?

Different search_path setting?

            regards, tom lane


Re: Weird query error from one of my users

От
Scott Mead
Дата:

On Mon, Nov 23, 2015 at 2:57 PM, John Scalia <jayknowsunix@gmail.com> wrote:
Hi all,

I have a user submitting a query involving a column that is an hstore type. The query seems to run just fine from her pgAdmin III console, but I cannot get it to run from a psql session.

Are you sure that the two of you are connected to the same instance ? 

 
I've been studying the hstore page on the postgresql site but nothing there is quite like this query on that page. Here's the query:

SELECT
        a.id as sva_id,
        m.account_number_hash as account_num_hash,
        a.status as status,
        a.balance_currency as currency,
        a.balance as balance,
        'datamart_fdw_m2'::text as platform
    FROM account a
    INNER JOIN switch_mcontainer m ON (m.attributes -> 'EXTERNAL_ID')::text = a.external_id::text;

The psql error says: ERROR:  operator does not exist: public.hstore -> unknown

I don't quite understand the error as the postgresql hstore page shows the "->" as a valid operator. Anyone have any ideas? And of course, the better question is why does it run correctly in pgAdmin? Please let me know if you need the table descriptions for either the account or mcontainer or both tables.

Thanks in advance,
Jay