Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg-safeupdate: init at 1.2 #62907

Merged
merged 1 commit into from Jun 11, 2019
Merged

Conversation

steve-chavez
Copy link
Member

Motivation for this change

pg-safeupdate is a simple extension to PostgreSQL that raises an error if UPDATE and DELETE are executed without specifying conditions.

To test this works you can do:

load 'safeupdate';
create temp table items( id int );
delete from items;
-- ERROR:  21000: DELETE requires a WHERE clause
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@steve-chavez
Copy link
Member Author

@marsam Hey! 😃 . Could I get you interested in reviewing this?

Copy link
Contributor

@marsam marsam left a comment

Choose a reason for hiding this comment

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

Thanks for the heads up. I left a pair of comments. Besides that, LGTM

owner = "eradman";
repo = pname;
rev = "${pname}-${version}";
sha256 = "010m57jcv5v8pyfm1cqs3a306y750lvnvla9m5d98v5vdx3349jg";
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting a different hash 0v4mf013a25fz8p2rw4vh0c9q6m1zddvm05grpawrwkaw33hjh7a

description = "A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
homepage = https://github.com/eradman/pg-safeupdate;
maintainers = [ maintainers.steve-chavez ];
platforms = platforms.linux;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
platforms = platforms.linux;
platforms = postgresql.meta.platforms;


meta = with stdenv.lib; {
description = "A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
homepage = https://github.com/eradman/pg-safeupdate;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick

Suggested change
homepage = https://github.com/eradman/pg-safeupdate;
homepage = "https://github.com/eradman/pg-safeupdate";

@steve-chavez
Copy link
Member Author

@marsam Thank you. All corrections done!

@@ -44,4 +44,6 @@ self: super: {
pgrouting = super.callPackage ./ext/pgrouting.nix { };

pg_partman = super.callPackage ./ext/pg_partman.nix { };

pg-safeupdate = super.callPackage ./ext/pg-safeupdate.nix { };
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this as pg_safeupdate to match the naming scheme of all the other extensions here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. The extension name has that dash(pg-safeupdate) so I left it like that but I don't see a problem with changing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@thoughtpolice Renaming done!

src = fetchFromGitHub {
owner = "eradman";
repo = pname;
rev = "${pname}-${version}";
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like upstream was retagged, can you update it with the new hash?

Suggested change
rev = "${pname}-${version}";
rev = version;

and before merge it, would you mind squashing the commits?

Copy link
Member Author

Choose a reason for hiding this comment

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

@marsam Done!

safeupdate is a simple extension to PostgreSQL that raises an error if
UPDATE and DELETE are executed without specifying conditions.
@thoughtpolice
Copy link
Member

@GrahamcOfBorg build postgresql.pkgs.pg_safeupdate

@thoughtpolice thoughtpolice merged commit e1f3167 into NixOS:master Jun 11, 2019
@thoughtpolice
Copy link
Member

Thanks a lot!

@steve-chavez
Copy link
Member Author

@thoughtpolice @marsam Thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants