Skip to content

Update master to M4#276

Merged
wildtayne merged 60 commits intomasterfrom
dev
Aug 18, 2018
Merged

Update master to M4#276
wildtayne merged 60 commits intomasterfrom
dev

Conversation

@wildtayne
Copy link
Copy Markdown
Contributor

@wildtayne wildtayne commented Aug 18, 2018

This PR adds the M4 changes to master

Sean Murthy and others added 30 commits August 12, 2018 09:43
Move functions that compare server version numbers to their own script
Created new script to contain just functions that compare server versions
Add the new script to the db-core installer
Moved test for server-version comparers to their own script
Test script for just functions that compare server versions.
Move server-version comparers to own script
Grudgingly used dynamic sql to execute CREATE INDEX IF NOT EXISTS so the script compiles with pre-pg9.5. Discarded the alternative of using just the pre-pg9.5 code for all versions to make sure the customization is easily found later.
The code to upgrade schema of table ConnectionActivity unnecessarily used IF NOT EXISTS. Removed this use and added comments to say why it is OK to remove IF NOT EXISTS.

Coincidentally, and fortunately, this change avoids having to execute pg-version specific code as required in Issue #230.
Using this edit as an opportunity to say:  Fixes #259
Had missed a couple more instances of Remove IF NOT EXISTS used with ADD COLUMN
Added gaurd for pg_event_trigger_ddl_commands() and updated testDDLActivityLogging.sql to support these changes
Guard CREATE INDEX IF NOT EXISTS for Postgres 9.4 or earlier
Added triggers to prevent row deletion over tables DDLActivity and ConnectionActivity. The tables can still be truncated, still only by ClassDB role or a superuser.

Fixes #176
Also fixed a bug in the part that tested existence of triggers: used to test if at least one of the triggers are defined, instead of testing if all expected triggers are defined.
Updated the function logDDLActivity to not add values to DDLAcitivity for drop statements in versions  < 9.5. Also removed update to test scripts as they are now unneeded.
Reject row deletion over tables DDLActivity and ConnectionActivity
…_commands()

Guard uses of pg_event_trigger_ddl_commands() for Postgres 9.4 or earlier
These guards prevent any statements in enableConnectionLoggignReco.psql and disableConnectionLoggingReco.psql from being run if the current Postgres server version is < 9.4.
Use the pre-defined role pg_signal_backend only in server versions 9.6 or later. Fixes #225

Note: Depending on server version is technically not correct because the functionality in question is determined on the existence of a specific server role which can be tested in the pg_roles table. However, testing for server version is more practical and maintainable.
Sean Murthy and others added 21 commits August 16, 2018 19:35
Use dynamic SQL to grant a role to CURRENT_USER in pg9.4 or earlier versions.

Fixes #229
Related to #229, but instead of guarding for  pg9.4 or earlier, reused the helper function ClassDB.grantRole. This keeps the test script simple and maintainable.
Must use dynamic SQL for all pg versions so the script compiles in pg versions 9.4 and earlier
Guard uses of ALTER SYSTEM for pg9.3 compatability
Use machine-readable version number to determine current server's version
Adds a temp function that when given a DROP OWNED BY query it will dynmically EXECUTE the query with an attach CURRENT_USER
Guard GRANT to CURRENT_USER in pg9.4 or earlier
initalizeServerCore.sql -> initializeServerCore.sql
Fix server initialization filename
Copy link
Copy Markdown
Member

@smurthys smurthys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to merge

Copy link
Copy Markdown
Contributor

@afig afig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge 😄

Copy link
Copy Markdown
Contributor

@KevinKelly25 KevinKelly25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to Merge

Copy link
Copy Markdown

@jrm86 jrm86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge

@wildtayne wildtayne merged commit e0db7e0 into master Aug 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants