Using column references in default expression

Поиск
Список
Период
Сортировка
Искать

Using column references in default expression

От:
Maximilian Tyrtania <mty@fischerappelt.de>
Дата:
Hi there,

I'm in the process of moving a rather large OpenBase database to PG 8.2.3.

In Openbase it was allowed to use column references in default expression,
which seems to be forbidden in PG.

You know, like that:

create table Mitarbeiter_Benutzergruppen (
 _rowid  longlong PRIMARY KEY DEFAULT nextval('serial') ,
 Mitarbeiter_id longlong index,
 Benutzergruppe_id longlong INDEX ,
 Unique_id varchar(1023) INDEX derived  Benutzergruppe_id+':'+Mitarbeiter_id
) 

That's OB Syntax, btw.

I bet PG has honorable reasons to restrict access to column references in
default expressions, i'm just wondering how to achieve that now. Do I really
have to write a rule or trigger?

Tia,

  Maximilian Tyrtania | IT-Entwickler
  Mty@fischerAppelt.de
  fischerAppelt Kommunikation GmbH
  Friedichstr. 149 | D-10117 Berlin | Germany
  Tel. ++49-30-726146-728 | Fax ++49-30-726146-710
  www.fischerAppelt.de



Re: Using column references in default expression

От:
Maximilian Tyrtania <mty@fischerappelt.de>
Дата:
Oliver Elphick was kind enough to tell me about using function results as
default values offlist. That was what I was looking for.

Thanks again,

Max

  Maximilian Tyrtania | IT-Entwickler
  Mty@fischerAppelt.de
  fischerAppelt Kommunikation GmbH
  Friedichstr. 149 | D-10117 Berlin | Germany
  Tel. ++49-30-726146-728 | Fax ++49-30-726146-710
  www.fischerAppelt.de


> 
> Hi there,
> 
> I'm in the process of moving a rather large OpenBase database to PG 8.2.3.
> 
> In Openbase it was allowed to use column references in default expression,
> which seems to be forbidden in PG.
> 
> You know, like that:
> 
> create table Mitarbeiter_Benutzergruppen (
>  _rowid  longlong PRIMARY KEY DEFAULT nextval('serial') ,
>  Mitarbeiter_id longlong index,
>  Benutzergruppe_id longlong INDEX ,
>  Unique_id varchar(1023) INDEX derived  Benutzergruppe_id+':'+Mitarbeiter_id
> ) 




FAQ