Hello Amit,
>>> $node->safe_psql('postgres',
>>> "CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ets';"
>>
>> I think that this last command fails if the path contains a "'", so the
>> '-escaping is necessary. I had to make changes in TAP tests before because
>> it was not working when the path was a little bit strange, so now I'm
>> careful.
>
> Hmm, I don't know what kind of issues you have earlier faced,
AFAICR, path with shell-sensitive characters ($ ? * ...) which was
breaking something somewhere.
> but tablespace creation doesn't allow quotes. See the message
> "tablespace location cannot contain single quotes" in CreateTableSpace.
Hmmm. That is the problem of CreateTableSpace. From an SQL perspective,
escaping is required. If the command fails later, that is the problem of
the command implementation, but otherwise this is just a plain syntax
error at the SQL level.
> Also, there are other places in tests like
> src/bin/pg_checksums/t/002_actions.pl which uses the way I have
> mentioned.
Yes, I looked at it and imported the window-specific function to handle
the path. It does not do anything about escaping.
> I don't think there is any need for escaping single-quotes
> here
As said, this is required for SQL, or you must know that there are no
single quotes in the string.
> and I am not seeing the use of same.
Sure. It is probably buggy there too.
> I don't want to introduce a new pattern in tests which people can then
> tomorrow copy at other places even though such code is not required.
> OTOH, if there is a genuine need for the same, then I am fine.
Hmmm. The committer is right by definition. Here is a version without
escaping but with a comment instead.
--
Fabien.