Re: Quoting issues with createdb

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Quoting issues with createdb
Date: 2020-02-27 02:24:33
Message-ID: 20200227022433.GB1969@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 27, 2020 at 12:00:11AM +0100, Daniel Gustafsson wrote:
> Makes sense, it aligns it with other utils and passes all the tests. +1 on the
> fix.

Thanks for the review.

> I would've liked a negative test basically along the lines of your example
> above. If we left a hole the size of this, it would be nice to catch it from
> accidentally happening again.

No arguments against that.

> program_help_ok('createdb');
> program_version_ok('createdb');
> @@ -24,3 +24,6 @@ $node->issues_sql_like(
>
> $node->command_fails([ 'createdb', 'foobar1' ],
> 'fails if database already exists');
> +
> +$node->command_fails(['createdb', '-l', 'C\';SELECT 1;' ],
> + 'fails on incorrect locale');

One problem with this way of testing things is that you don't check
the exact error message triggered, and this command fails with or
without the patch, so you don't actually know if things are correctly
patched up or not. What should be used instead is command_checks_all,
available down to 11 where we check for a failure and a match with the
error string generated. I have used that, and applied the patch down
to 9.5.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-02-27 02:37:02 Re: Commit fest manager for 2020-03
Previous Message Michael Paquier 2020-02-27 01:52:38 Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line