Skip site navigation (1) Skip section navigation (2)

Loading current_user and current_timestamp using COPY

From: Herb Blacker <herbblacker(at)isgenesis(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Loading current_user and current_timestamp using COPY
Date: 2001-10-08 15:34:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I'm trying to load the current_user and current timestamp (as an audit) 
in a set of data using the COPY FROM... statement.
I cannot get the session_user, current_user or user to give me anything 
but the text itself...I even tried the obsolete getpgusername() and 
thats exactly what it entered!

To get the current_timestamp, I had to use the now() function.

The declaration for the fields is:
updateUserId    text      DEFAULT current_user,
updateTimestamp timestamp DEFAULT current_timestamp,
Am I doing something wrong?

Thanks in advance,
Herb Blacker
Database Administrator
ReCare, Inc.
(512) 791-4340

pgsql-novice by date

Next:From: Josh BerkusDate: 2001-10-08 15:47:55
Subject: Re: Starting Postmaster at boot
Previous:From: Duncan Adams (DNS)Date: 2001-10-08 10:03:54
Subject: sequence last_value

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group