pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: annika.ruohtula@gmail.com
Subject: BUG #17616: Silently skipping to update data to the database with owner privileges using flyway scripts
Date: Fri, 16 Sep 2022 10:00:24 +0000
Message-ID: <17616-195bac997f5bac61@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17616
Logged by:          Annika Ruohtula
Email address:      annika.ruohtula@gmail.com
PostgreSQL version: 12.12
Operating system:   Windows
Description:        

Flyway scripts are using the owner account everywhere to create, update and
drop objects in the database. The scripts are also maintaining a lot of
configuration related data in the tables. The scripts also create other
privileges for application level users with ALTER DEFAULT PRIVILEGES command
in the first migration scripts. There are no issues with the privileges when
using the application in the test and production environments.
The flyway-scripts have been working very well a couple of years already.
There are about 200 migration scripts already.
About a week ago I found that one update script was silently ignoring
updating data to a table. The migration script was first adding a new column
to existing table and then updating data to the column. The same sql
statements were working fine when running them using SQL console. I also
moved the existing flyway script backwards in the running order and took
another older one in place of it. After that the older one which was working
fine in the running order earlier was now also ignoring updating the data to
the table (so the issue didn't seem to relate with the actual sql statements
but rather when the sql statements was run). So it seemed like the issue was
caused by some timing related thing (maybe elapsed time from the beginning
of executing the first flyway script).
I found a workaround which seemed to fix the issue: I added grant-statement
"GRANT USAGE ON SCHEMA <our schema> TO "<owner of the db>"" after adding the
column to the table and before the actually updating the data to the new
column. After that, the update-statement was working ok.
Then we decided in the team meeting to add the same statement before each
migration as a hook. Currently it has been working ok, but of course we are
a bit worried about the situation, because in theory this should not be
needed for the owner of the database. Is it possible there is some bug here
related to some timing how the default privileges and the instantiated
privileges are generated?



view thread (2+ messages)  latest in thread

Message-ID: <17616-195bac997f5bac61@postgresql.org>
Permalink:  ../17616-195bac997f5bac61@postgresql.org/
Also on:    postgresql.org/message-id/17616-195bac997f5bac61@postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, annika.ruohtula@gmail.com
  Subject: Re: BUG #17616: Silently skipping to update data to the database with owner privileges using flyway scripts
  In-Reply-To: <17616-195bac997f5bac61@postgresql.org>

* 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