CURRENT_USER

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

CURRENT_USER

От:
thiemo <thiemo@gmx.ch>
Дата:
Hi,


I try to set up a view that selects rows from a table according the
connected user. However, I issue

CREATE VIEW v_dummy AS

  SELECT

    dummy

    , usr

  FROM t_dummy

  WHERE usr = CURRENT_USER

;

but the following error is returned.

ERROR: Unable to identify an operator '=' for types 'character
varying' and 'name'. You will have to retype this query using an
explicit cast.


So I to_char(CURRENT_USER, *somewhat*) but to no avail.


I'd appreciate any hint. BTW, I use DBVisualizer 2.1 to build my dbs.


Thx


Thiemo

Helvetica

--

Thiemo Kellner

Tösstalstrasse 146

CH-8400 Winterthur

Hi,

I try to set up a view that selects rows from a table according the 
connected user. However, I issue
CREATE VIEW v_dummy AS
   SELECT
     dummy
     , usr
   FROM t_dummy
   WHERE usr = CURRENT_USER
;
but the following error is returned.
ERROR: Unable to identify an operator '=' for types 'character varying' 
and 'name'. You will have to retype this query using an explicit cast.

So I to_char(CURRENT_USER, *somewhat*) but to no avail.

I'd appreciate any hint. BTW, I use DBVisualizer 2.1 to build my dbs.

Thx

Thiemo

--
Thiemo Kellner
Tösstalstrasse 146
CH-8400 Winterthur

Re: CURRENT_USER

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
thiemo  writes:
>    WHERE usr =3D CURRENT_USER
> but the following error is returned.
> ERROR: Unable to identify an operator '=3D' for types 'character varying'=
> =20
> and 'name'. You will have to retype this query using an explicit cast.

Hmm... probably there should be an implicit conversion from NAME to TEXT
.. but in the meantime try

   WHERE usr = CURRENT_USER::varchar

			regards, tom lane
FAQ