pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Herb Blacker <herbblacker@isgenesis.com>
To: pgsql-novice@postgresql.org
Subject: Re: Loading current_user and current_timestamp using COPY
Date: Tue, 09 Oct 2001 14:33:11 -0700
Message-ID: <web-144724@davinci.ethosmedia.com> (raw)
In-Reply-To: <3BC31321.1000807@isgenesis.com>

Herb,

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

Hmmm ... I was under the impression that you could not use any builtin
functions with COPY.  Just literals.  I'm surprised that NOW() worked.

Just in case, I'm cross-posting your question to the SQL list.

Couple of suggestions for immediate workarounds:
1. If the data sets you are importing are small, use INSERT statements
instead of COPY.
2. If you are importing large amounts of data, do the following:



______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (5+ messages)  latest in thread

Message-ID: <web-144724@davinci.ethosmedia.com>
Permalink:  ../web-144724@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-144724@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, herbblacker@isgenesis.com, pgsql-novice@postgresql.org
  Subject: Re: Loading current_user and current_timestamp using COPY
  In-Reply-To: <web-144724@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox