parse_psql_options(argc, argv, &options);
- if (!pset.popt.topt.fieldSep)
- pset.popt.topt.fieldSep = pg_strdup(DEFAULT_FIELD_SEP);
- if (!pset.popt.topt.recordSep)
- pset.popt.topt.recordSep = pg_strdup(DEFAULT_RECORD_SEP);
+ if (!pset.popt.topt.fieldSep.separator &&
+ !pset.popt.topt.fieldSep.separator_zero)
+ {
+ pset.popt.topt.fieldSep.separator = pg_strdup(DEFAULT_FIELD_SEP);
+ pset.popt.topt.fieldSep.separator_zero = false;
+ }
+ if (!pset.popt.topt.recordSep.separator &&
+ !pset.popt.topt.recordSep.separator_zero)
+ {
+ pset.popt.topt.recordSep.separator = pg_strdup(DEFAULT_RECORD_SEP);
+ pset.popt.topt.recordSep.separator_zero = false;
+ }
if (options.username == NULL)
password_prompt = pg_strdup(_("Password: "));
{"echo-hidden", no_argument, NULL, 'E'},
{"file", required_argument, NULL, 'f'},
{"field-separator", required_argument, NULL, 'F'},
+ {"field-separator-zero", no_argument, NULL, 'z'},
{"host", required_argument, NULL, 'h'},
{"html", no_argument, NULL, 'H'},
{"list", no_argument, NULL, 'l'},
{"pset", required_argument, NULL, 'P'},
{"quiet", no_argument, NULL, 'q'},
{"record-separator", required_argument, NULL, 'R'},
+ {"record-separator-zero", no_argument, NULL, '0'},
{"single-step", no_argument, NULL, 's'},
{"single-line", no_argument, NULL, 'S'},
{"tuples-only", no_argument, NULL, 't'},
memset(options, 0, sizeof *options);
- while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VwWxX?1",
+ while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VwWxXz?01",
long_options, &optindex)) != -1)
{
switch (c)
options->action_string = optarg;
break;
case 'F':
- pset.popt.topt.fieldSep = pg_strdup(optarg);
+ pset.popt.topt.fieldSep.separator = pg_strdup(optarg);
+ pset.popt.topt.fieldSep.separator_zero = false;
break;
case 'h':
options->host = optarg;
SetVariableBool(pset.vars, "QUIET");
break;
case 'R':
- pset.popt.topt.recordSep = pg_strdup(optarg);
+ pset.popt.topt.recordSep.separator = pg_strdup(optarg);
+ pset.popt.topt.recordSep.separator_zero = false;
break;
case 's':
SetVariableBool(pset.vars, "SINGLESTEP");
case 'X':
options->no_psqlrc = true;
break;
+ case 'z':
+ pset.popt.topt.fieldSep.separator_zero = true;
+ break;
+ case '0':
+ pset.popt.topt.recordSep.separator_zero = true;
+ break;
case '1':
options->single_txn = true;
break;