Unix Technical Forum

session_user id

This is a discussion on session_user id within the pgsql Novice forums, part of the PostgreSQL category; --> Hi All, I have the following table that is used to log the receipt of an item. As you ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 09:32 PM
Keith Worthington
 
Posts: n/a
Default session_user id

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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com