Re: Triggers and Domains - Mailing list pgsql-novice

From ekekakos
Subject Re: Triggers and Domains
Date
Msg-id 25214251.post@talk.nabble.com
Whole thread Raw
In response to Re: Triggers and Domains  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Triggers and Domains  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Triggers and Domains  (Lennin Caro <lennin.caro@yahoo.com>)
List pgsql-novice
It does not work.
I run your script
create domain username as text default user;
through PGADMIN and I get the following
CREATE DOMAIN username
  AS text
  DEFAULT "current_user"();
ALTER DOMAIN username OWNER TO ekekakos;

I create a field in a table and I am getting the following script:
ALTER TABLE "Library"."Contacts" ADD COLUMN "LastUser" username;
ALTER TABLE "Library"."Contacts" ALTER COLUMN "LastUser" SET STORAGE
EXTENDED;

And it does not work during the update.

Thanks
Elias


Tom Lane-2 wrote:
>
> ekekakos <ekekakos@hol.gr> writes:
>> Thanks but how, in SQL server you put the function USER() (if I remember
>> well) and it works.
>> Here it does not work.
>
> Define "does not work", please?
>
> regression=# create domain username as text default user;
> CREATE DOMAIN
> regression=# create table foo(f1 int, lastupdateuser username);
> CREATE TABLE
> regression=# insert into foo(f1) values(42);
> INSERT 0 1
> regression=# select * from foo;
>  f1 | lastupdateuser
> ----+----------------
>  42 | postgres
> (1 row)
>
>
>             regards, tom lane
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>
>

--
View this message in context: http://www.nabble.com/Triggers-and-Domains-tp25209238p25214251.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Triggers and Domains
Next
From: Tom Lane
Date:
Subject: Re: Triggers and Domains