Re: Converting sql anywhere to postgres

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Converting sql anywhere to postgres
Date: 2023-08-16 22:31:20
Message-ID: 41ced76e-3096-d0f4-549d-e15d7db6964c@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message [Quipsy] Markus Karg 2023-08-17 07:31:27 AW: AW: Cast INTEGER to BIT confusion
Previous Message Rob Sargent 2023-08-16 21:16:26 Re: Converting sql anywhere to postgres