From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Converting sql anywhere to postgres
Date: Wed, 16 Aug 2023 15:31:20 -0700
Message-ID: <41ced76e-3096-d0f4-549d-e15d7db6964c@aklaver.com> (raw)
In-Reply-To: <04070FB3-728A-450D-8B54-FA8DFDA4500E@gmail.com>
References: <VI1P191MB0638DF6A32205FA51983F92AF215A@VI1P191MB0638.EURP191.PROD.OUTLOOK.COM>
<3fa3d5c7-67b5-444e-9bbd-4e1a8d7f549a@Spark>
<94459638-f09a-64c5-49c5-9b8462b391ab@gmail.com>
<7de51aeb-600d-3375-ad65-6249f8e8f8a9@aklaver.com>
<04070FB3-728A-450D-8B54-FA8DFDA4500E@gmail.com>
On 8/16/23 14:16, Rob Sargent wrote:
>
>>>>> I have just had a quick look at rules and I am not sure how it can be done. Rules still use the concept of NEW and OLD. If my original row has 'myfield' set to 'me' then I don't think I can tell the difference between:
>>>>>
>>>>> Update mytable set afield='something'
>>>>> and
>>>>> Update mytable set afield='something',myfield='me'
>>>>>
>>>>> Within the rule I think NEW.myfield will be set to 'me' in both cases. Please can you explain how I can tell the difference between the two update statements
>>>>>
>>> If the original value in the user column is "me", what is the difference between "set other_column = some_value, user = 'me'" and "set other_column = some_value" at the business level?
>>
>> Affirmation that the user updating the record explicitly set the user value.
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com
>>
> Agreed. But at the end of the day, the difference is what exactly? Wouldn't auditing (short of sql logging) say “no change” with respect to “me” column?
That is above my pay grade, that is for the OP to elaborate on. I was
just saying that the Postgres server could not make that distinction
with the information provided.
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, robjsargent@gmail.com
Subject: Re: Converting sql anywhere to postgres
In-Reply-To: <41ced76e-3096-d0f4-549d-e15d7db6964c@aklaver.com>
References: <VI1P191MB0638DF6A32205FA51983F92AF215A@VI1P191MB0638.EURP191.PROD.OUTLOOK.COM> <3fa3d5c7-67b5-444e-9bbd-4e1a8d7f549a@Spark> <94459638-f09a-64c5-49c5-9b8462b391ab@gmail.com> <7de51aeb-600d-3375-ad65-6249f8e8f8a9@aklaver.com> <04070FB3-728A-450D-8B54-FA8DFDA4500E@gmail.com> <41ced76e-3096-d0f4-549d-e15d7db6964c@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox