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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Fri, 27 Feb 1998 17:25:46 +0000 (GMT)
sferac@bo.nettuno.it
CURRENT_USER
> java=> CREATE TABLE tabella(campo VARCHAR(30) DEFAULT CURRENT_USER);
> ERROR:  DEFAULT: type mismatched
> 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?

Yup.


Mon, 02 Mar 1998 14:02:31 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] CURRENT_USER