Re: What have I done!?!?!? :-)

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
Cc: Jan Wieck <jan(at)wi3ck(dot)info>, Perry Smith <pedz(at)easesoftware(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: What have I done!?!?!? :-)
Date: 2022-04-08 12:58:16
Message-ID: CABUevEx22cC2xOTuEG_hiWq3Ed3eZvuFb=CUxtFdP8cmUKuvZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 8, 2022 at 7:57 AM Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
wrote:

> On Thu, Apr 7, 2022 at 8:10 AM Jan Wieck <jan(at)wi3ck(dot)info> wrote:
>
>> So **IF** Active Record is using that feature, then it can dump any
>> amount of garbage into your PostgreSQL database and PostgreSQL will
>> happily accept it with zero integrity checking.
>>
>
> It's DISABLE TRIGGER ALL
> https://github.com/rails/rails/blob/831031a8cec5bfe59ef653ae2857d4fe64c5698d/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb#L12
>

A side-note on this, which of course won't help the OP at this point, but
if the general best practice of not running the application with a highly
privileged account is followed, the problem won't occur (it will just fail
early before breaking things). DISABLE TRIGGER ALL requires either
ownership of the table or superuser permissions, none of which it's
recommended that the application run with. Doesn't help once the problem
has occurred of course, but can help avoid it happening in the future.

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/>
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2022-04-08 13:07:28 Re: How to get updated order data
Previous Message Jan Wieck 2022-04-08 12:47:46 Re: What have I done!?!?!? :-)