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