CURRENT_USER - Mailing list pgsql-hackers

From sferac@bo.nettuno.it
Subject CURRENT_USER
Date
Msg-id Pine.LNX.3.96.980227170759.9357A-100000@nero
Whole thread Raw
List pgsql-hackers
Hi

I tried to define a table on my Linux box, PostgreSQL 6.3 as:

java=> CREATE TABLE tabella(campo VARCHAR(30) DEFAULT CURRENT_USER);
ERROR:  DEFAULT: type mismatched

java=> CREATE TABLE tabella(campo VARCHAR(30));
CREATE
java=> insert into tabella values (CURRENT_USER);
ERROR:  parser: attribute 'campo' is of type 'varchar' but expression is of type 'name'

java=> insert into tabella values (CAST CURRENT_USER AS VARCHAR);
ERROR:  func_get_detail: function varchar(name) does not exist
java=> insert into tabella values (CURRENT_USER::VARCHAR);
ERROR:  func_get_detail: function varchar(name) does not exist

and I had this error. PostgreSQL CURRENT_USER returns a type "name",
but SQL-Standard says that niladic builtin function CURRENT_USER returns a
CHARACTER string representing the current authorization ID and "name" isn't
an SQL type. I think this is a bug. What do you think about?

(see A Guide To The SQL Standard C.J.Date).

                                                            Ciao, Jose'
                                   ___,   /
                                  |_+_|  /|   /    ~
~~~~~~~~~~~~~~~~~~~~~~~~~             | / |  /|           ~~~~~~~~~~~~~~~~~~~~~
    Jose' Soares Da Silva    ~        |/  | / |    /      "As armas e os Baroes
   Progetto "OS LUSIADAS"      ~      |   |/| |   /|        assinalados, que da
     SFERA CARTA SOFTWARE    ~       /|   / | |  / |  Occidental praia Lusitana
        Via Bazzanese, 69           / |  /  | | /| |   por mares nunca de antes
Casalecchio R. BO - Italy          /  | /   | |/ | |       navegados, passarono
http://www.sferacarta.com         /   |/____|_/__|_|   ainda alem da Taprobana"
     sferac@bo.nettuno.it        /____|__|  |  __|___________              ~
     Fax. ++39 51 6131537 ____________|_____|_/ LUSIADAS /     (Luis de Camoes,
     Tel. ++39 51  591054  \  o                         / Os Lusiadas, canto I)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Rule plan size for views?
Next
From: Andrew Martin
Date:
Subject: Last minute reminders (hope they're not too late...)