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-09 15:09:21
Message-ID: 3BC31321.1000807@isgenesis.com (view raw or flat)
Thread:
Lists: pgsql-novicepgsql-sql
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.



Responses

pgsql-novice by date

Next:From: Herb BlackerDate: 2001-10-09 15:26:52
Subject: Loading current_user and current_timestamp using COPY
Previous:From: Tom LaneDate: 2001-10-09 13:57:39
Subject: Re: Rules and Views

pgsql-sql by date

Next:From: Stephan SzaboDate: 2001-10-09 15:38:30
Subject: Re: Problem with n to n relation
Previous:From: Alexander DeruweDate: 2001-10-09 13:24:00
Subject: Linking against null-fields.

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