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

session_user id

From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: session_user id
Date: 2005-02-24 18:35:21
Message-ID: 20050224182645.M35953@narrowpathinc.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi All,

I have the following table that is used to log the receipt of an item.  As you
can see the receipt_timestamp uses a default of now.  I would like to add a
column with a default of the session user.  In order to avoid column length
sizing issues and keep the table small I thought that I could store the
session_user id ( int4 ) instead of the text name ( varchar(?) ).  How can
this be done?

CREATE TABLE purchase_order.tbl_receiving
(
  po_number int4 NOT NULL,
  po_line int2 NOT NULL,
  receipt_number serial NOT NULL,
  quantity float4 NOT NULL,
  receipt_timestamp timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6)
with time zone,
  CONSTRAINT tbl_receiving_pkey PRIMARY KEY (po_number, po_line, receipt_number),
  CONSTRAINT tbl_receiving_fkey1 FOREIGN KEY (po_number, po_line) REFERENCES
purchase_order.tbl_line_item (po_number, po_line) ON UPDATE CASCADE ON DELETE
RESTRICT
) 

Kind Regards,
Keith

pgsql-novice by date

Next:From: George WeaverDate: 2005-02-24 19:44:24
Subject: Re: shutdown postmaster question
Previous:From: operationsengineer1Date: 2005-02-24 18:27:10
Subject: Re: shutdown postmaster question

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