Re: Some Questions

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
Cc: PostgreSQL Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Some Questions
Date: 2003-06-12 14:33:13
Message-ID: 20030612072513.O25608-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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).

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Treat 2003-06-12 14:44:30 Re: control structures in plpgsql
Previous Message Stephan Szabo 2003-06-12 14:24:02 Re: control structures in plpgsql