Re: proposal: possibility to read dumped table's name from file

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: possibility to read dumped table's name from file
Date: 2020-07-12 01:43:07
Message-ID: CALDaNm1iGfcBquWQEhCg5horyMROZc0x3_tQw-v=3hr8MxtOoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 6, 2020 at 10:05 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> here is support for comment's line - first char should be #
>

Few comments:
+ str = fgets(*lineptr + total_chars,
+ *n - total_chars,
+ fp);
+
+ if (ferror(fp))
+ return -1;

Should we include any error message in the above case.

+ else
+ break;
+ }
+
+ if (ferror(fp))
+ return -1;

Similar to above.

+ /* check, if there is good enough space for
next content */
+ if (*n - total_chars < 2)
+ {
+ *n += 1024;
+ *lineptr = pg_realloc(*lineptr, *n);
+ }
We could use a macro in place of 1024.

+ if (objecttype == 't')
+ {
+ if (is_include)
+ {
+
simple_string_list_append(&table_include_patterns,
+
objectname);
+
dopt.include_everything = false;
+ }
+ else
+
simple_string_list_append(&table_exclude_patterns,
+
objectname);
+ }
+ else if (objecttype == 'n')
+ {
+ if (is_include)
+ {
+
simple_string_list_append(&schema_include_patterns,
+
objectname);
+
dopt.include_everything = false;
+ }
+ else
+
simple_string_list_append(&schema_exclude_patterns,
+
objectname);
+ }
Some of the above code is repetitive in above, can the common code be
made into a macro and called?

printf(_(" --extra-float-digits=NUM override default
setting for extra_float_digits\n"));
+ printf(_(" --filter=FILENAME read object name
filter expressions from file\n"));
printf(_(" --if-exists use IF EXISTS when
dropping objects\n"));
Can this be changed to dump objects and data based on the filter
expressions from the filter file.

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-07-12 02:34:48 Re: Default setting for enable_hashagg_disk
Previous Message Jaka Jančar 2020-07-12 00:48:08 Re: StartupMessage parameters - free-form or not?