Re: Some Questions - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Some Questions
Date
Msg-id 20030612072513.O25608-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Some Questions  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
List pgsql-sql
On Thu, 12 Jun 2003, Ludwig Lim wrote:

>     I would like to ask the following questions:
> a) Are foreign key constraint triggers guaranteed to
> execute first before any ordinary "BEFORE
> INSERT/UPDATE/DELETE" trigger is executed? (This is
> assuming that the foreign keys are declared as "NOT
> DEFERRABLE")

No.  Before triggers are going to get run before the action
occurs, the constraint triggers are in general going to run
after the action occurs (before triggers might change
information about the new row). It'll currently run in
the after triggers where it false in name order so you
can place after triggers before or after the constraint
trigger.

> b) Is "varchar" (without upper limit) the same as
> "text"?

Not quite, but it's close (there might still be issues
with mismatching set returning function returns and probably
some other similar cases).

>    I do notice that when I create a view :
>    create view v_test as (select 'test'::varchar(10)
> union select 'test1'::varchar(10));
>
>    a "\d v_test" on the psql prompt would always say
> the only only column the view is of type "character
> varying". Does a union of a varchar(n) column and a
> another varchar(n) column would automatically cast it
> to "character varying" (w/o upper limit) even if the
> upper limit of the 2 varchar columns are the same?

As a side note, in 7.4, create view reports the type as
character varying and a create table as reports it as
character varying(10).



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: control structures in plpgsql
Next
From: Robert Treat
Date:
Subject: Re: control structures in plpgsql