Hello,
I need a trigger which is updating a delete flag of a row instead of
deleting it physically.
How do I implement a trigger which doesn't execute a delete without raising
an exception
in plsql ?
CREATE TRIGGER trigger1 BEFORE DELETE ON table1
FOR EACH ROW EXECUTE PROCEDURE setDeleteFlag ();
I'm not a postgres expert, and I certainly don't know the details of your
situation, but it seems to me you may want to use a rule instead of a
trigger.
Then, you can intercept the delete query and simply re-write it to be an
update query that sets your deleted flag.
--
Matthew Nuzum
www.bearfrui
I believe that if you return NULL from the trigger
function, the delete will not actually be done. You
could set the value of the delete flag by reference to
OLD.fieldname.
I have not actually done this myself, so caveat
emptor.
--- Albrecht Berger <[EMAIL PROTECTED]> wrote:
> Hello,
> I need a
"Albrecht Berger" <[EMAIL PROTECTED]> writes:
> I need a trigger which is updating a delete flag of a row instead of
> deleting it physically.
> How do I implement a trigger which doesn't execute a delete without raising
> an exception in plsql ?
If the BEFORE DELETE trigger returns NULL, the del
hello,
Can anyone help me create a function that creates a
table, in this way for example :
create function create_table(text) returns integer as
'
begin
create table $1 (id integer, stuff text);
return 0;
end;'
language plpgsql;
it does not work !!
thnx
__
On Fri, 13 Jun 2003, Demidem Mohamed Amine wrote:
> hello,
>
> Can anyone help me create a function that creates a
> table, in this way for example :
See EXECUTE for a way to execute a query that you've built into
a string, for example, something like:
EXECUTE ''create table '' || $1 || '' (id i
Tom Lane wrote:
[EMAIL PROTECTED] writes:
i'd like to write an rule which fills out some empty attrs on
insert (w/ data from other given attrs).
You'd be better off doing this with a BEFORE INSERT trigger.
The only way to do it with rules would be to create a view over the
basetable, create an in
--- Demidem Mohamed Amine <[EMAIL PROTECTED]> wrote:
> hello,
>
> Can anyone help me create a function that creates a table:
create function create_table( text ) returns integer as '
declare
p_tab alias for $1;
v_exec text;
begin
v_exec := ''create table '' || p_tab || ''( id integer )'';
Hello,
I am building an rpm for Mitle SME (a scaled down redhat 7.3) and
have all functions working except:
I need to have the rpm when installed create a database and a
user with privilege to that database. These commands are easy
enough in general...
# service postgre
On Thu, 12 Jun 2003, Cedar Cox wrote:
> It's been a while since I've done much SQL..
>
> . I'm wondering which of these two queries is faster (both get the
> same result)?
>
> . Which one is more correct? Does it even matter or are they the
> same? The first one reads easier to me.
>
> . Wha
On Thu, 12 Jun 2003, David Pradier wrote:
> On Thu, Jun 12, 2003 at 01:16:27PM +0200, Christoph Haller wrote:
> > >
> > > i ran today in a problem when doing some (i mean too much for me)
> > advanced sql...
> > >
> > > What i want to do is something like this:
> > >
> > > SELECT
> > > my_va
11 matches
Mail list logo