Thread

  1. CURRENT_USER

    Ordini <sferac@bo.nettuno.it> — 1998-02-27T17:25:46Z

    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)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    
    
  2. Re: [HACKERS] CURRENT_USER

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 1998-03-02T14:02:31Z

    > 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.