Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hh3V8-0006v8-7i for pgsql-general@arkaria.postgresql.org; Sat, 29 Jun 2019 02:54:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hh3V5-0004b9-W0 for pgsql-general@arkaria.postgresql.org; Sat, 29 Jun 2019 02:54:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hh3V5-0004b2-GT for pgsql-general@lists.postgresql.org; Sat, 29 Jun 2019 02:54:03 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hh3Uy-0000GR-4T for pgsql-general@postgresql.org; Sat, 29 Jun 2019 02:54:02 +0000 Received: by mail-io1-xd44.google.com with SMTP id m24so16678475ioo.2 for ; Fri, 28 Jun 2019 19:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=LUd1YcOMZa0xPNKK8PIk7RlszLweX2i5C5SuIfa22cg=; b=A190SYR94L/3tdGTw3aQHafNvjRr096xaACDTAX9TEoC/Ybccq1kLq8bGEU5sv1von FDbqcRWNs4EHlAnblCFUtiVz11UYLNlOJQjhYElrZtEJFz1HOQDDmywvUdlzXNdV4PcV mQohPYefrtonb6y3TYsa15pqKlviqK+PjI37N/TfhSFSH47WKcroI6iVOhfVTa8cjQ4I NJPRCoEuvfM2NI0+YQkqWyeOWJs7CRDOWIOdcFZYUt80HIrIdct2bbdMaFDlKJQ5KVlv 3y3Ze846u/4xVgJq+UDw5+L+yy8MgS0RaJhixHO6/FPSHAIeQJrq7XFdPeybHVZxoQY1 dhCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=LUd1YcOMZa0xPNKK8PIk7RlszLweX2i5C5SuIfa22cg=; b=CkUK1XOmxwxS2YDxRJ2AiiZsjfa/YBE9n5811WoDAM5hnn2DJJi3dvOj0qO/spY8BB o/2WjPwXM2bZULzBPzmuCHxmWXr3eUP+NktMQefDNejcPigzc4zEDQJTgxN+AaBdIJmE g2/iKe3TdG8+IsTyiDm7v02dKZ5qCG8KqDxQfyHJKOzNydNYo9i+zlIJ4PdhNwzyrvLv xMG0tu+14DwG1LAUqQ1ZAYMeScCWNiwDkgQWvj0lLiuhka6feYfyE6C0CbJM9XFDDrnP Xf3tlhi2uw5FqPt1+XnVdyRdx9a1r6o5+HRLwp8tFDPwG3EPVucpnzJT5NhmPT4t9hF4 +TUQ== X-Gm-Message-State: APjAAAVrnbF3dlfhVK7n6oZeqX7VEvxN7U1TBFx6PV7c8e/AANA55T+v rFtjF7dYEjhl/T9XXKrPQnAkyTWFPJU= X-Google-Smtp-Source: APXvYqxagCR+racdF4sAf4tUJyNoI5CvsIvF8CZF8mBPJwWCOBg/BGj84ecyFXzqYYiwHJ899fRRNw== X-Received: by 2002:a02:8a:: with SMTP id 132mr14732330jaa.89.1561776833796; Fri, 28 Jun 2019 19:53:53 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:96c:1499:2744:6b9e? ([2600:1700:4000:8120:96c:1499:2744:6b9e]) by smtp.googlemail.com with ESMTPSA id l5sm6195222ioq.83.2019.06.28.19.53.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 19:53:53 -0700 (PDT) To: pgsql-general From: "Igal @ Lucee.org" Subject: Trigger function does not modify the NEW value Message-ID: <04592c40-829d-a31e-790a-96afbc108c0a@lucee.org> Date: Fri, 28 Jun 2019 19:53:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------353B2BFD8878077C64000641" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------353B2BFD8878077C64000641 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I have a trigger that is created like so:     create trigger tr_on_table_modified after insert or delete or update         on some_table for each row execute procedure on_table_modified();     CREATE OR REPLACE FUNCTION on_table_modified() RETURNS trigger LANGUAGE plpgsql $$         /* some code that does not modify any values but calls PERFORM on another function */         raise notice 'lowercasing %', new.email;         new.email = lower(new.email);         raise notice '    to %', new.email;         return new;     $$ I can see in the output the notices with the expected values, but the value in the updated record is not lower-cased. update some_table set    email = 'IGAL@Lucee.org' where  id = 1; > 00000: lowercasing IGAL@Lucee.org > 00000:     to igal@lucee.org select email from   some_table where  id = 1; > email         | > --------------| > IGAL@Lucee.org| Any ideas? Thanks, Igal Sapir Lucee Core Developer Lucee.org --------------353B2BFD8878077C64000641 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

I have a trigger that is created like so:

    create trigger tr_on_table_modified after insert or delete or update
        on some_table for each row execute procedure on_table_modified();

    CREATE OR REPLACE FUNCTION on_table_modified() RETURNS trigger LANGUAGE plpgsql $$
        /* some code that does not modify any values but calls PERFORM on another function */
       
        raise notice 'lowercasing %', new.email;
        new.email = lower(new.email);
        raise notice '    to %', new.email;

        return new;
    $$

I can see in the output the notices with the expected values, but the value in the updated record is not lower-cased.

update some_table
set    email = 'IGAL@Lucee.org'
where  id = 1;

> 00000: lowercasing IGAL@Lucee.org
> 00000:     to igal@lucee.org

select email
from   some_table
where  id = 1;

> email         |
> --------------|
> IGAL@Lucee.org|

Any ideas?

Thanks,

Igal Sapir
Lucee Core Developer
Lucee.org

--------------353B2BFD8878077C64000641--