After some consideration, I've created a new patch that addresses even more
of the various concerns.

Most notably, the command-line option is shortened to simply --where, which
is much easier to read and understand,
and matches the earlier proposal [1].



>  bool
> -simple_oid_list_member(SimpleOidList *list, Oid val)
> +simple_oid_list_member2(SimpleOidList *list, Oid val, void **extra_data)
>
> I feel like that isn't in the spirit of Lisp "member".  It's now a
> kind of association list.


My new patch has this function named simple_oid_list_find_data, to indicate
that it's working with some extra data,
and the corresponding append is called simple_oid_list_append_data.


> Another problem is that your spec does not show
> us how you would handle tables like Foo.Bar or "foo:bar" (colon have
> to be escaped)?

This is now addressed in the v4 patch.  I've added a new function to
string_utils,
called findUnquotedChar, which is used to find the colon character in the
command-line argument,
which separates the table name from the filter clause.

For example, if you have a table called "foo:bar", then you would use the
--where option as follows:

  pg_dump --where '"foo:bar":created_at >= '2018-05-01'" dbname

If you have a table with a double-quote in the name (gah!), as well as
colons, like:  has"quote:and:colons
then this still works, because such quotes in the name are escaped by
doubling the quote char,
e.g. "has""quote:and:colons", and also works with this patch:

  pg_dump --where '"has""quote:and:colons":created_at >= '2018-05-1'" dbname


[1] https://ci.appveyor.com/project/postgresql-cfbot/
postgresql/build/1.0.311

Attachment: pgdump-include-table-data-where-v4.patch
Description: Binary data

Reply via email to