Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Feature request


  • From: <Eugen(dot)Konkov(at)aldec(dot)com>
  • To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
  • Cc: <pgsql-bugs(at)postgresql(dot)org>
  • Subject: Re: Feature request
  • Date: Mon, 5 May 2008 20:26:38 +0300
  • Message-id: <002c01c8aed5$2d81fda0$1200a8c0(at)kharkov(dot)localhost>

There is situation where I check values and if they do not satisfy some condition I need to set default.
What is the best way to do that?

----- Original Message ----- From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: <Eugen(dot)Konkov(at)aldec(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Sent: Monday, May 05, 2008 8:10 PM
Subject: Re: [BUGS] Feature request


Hello

2008/5/5  <Eugen(dot)Konkov(at)aldec(dot)com>:
So why I can do:
insert into (id) values ( default )
and can not do in my trigger:
new.id = default
Why?

it's not possible - because you cannot mix PL/pgSQL statement
(assignment) and SQL stetement.

syntax of assignment
:
variable := expression

expression is independent on variable, so there are not any "default"
expression. PL/pgSQL and SQL are independent environments. If you need
default values, simply don't change field.

Regards
Pavel Stehule




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group