pg2evd
(since EVL 2.6)
Read the definition of PostgreSQL table and write EVD to standard output or to <file.evd>
.
Password is taken:
- from file ‘$EVL_PASSFILE’, which is by default ‘$HOME/.evlpass’,
- from file ‘$PGPASSFILE’, which is by default ‘$HOME/.pgpass’.
When such file has not permissions 600, it is ignored! For details see ‘evl-password’.
Synopsis
pg2evd [<database>.]<table> [-o|--output=<file.evd>] [--psql=<psql_options>] [--dbname=<database>] [--host=<hostname>] [--port=<port>] [--username=<pguser>] [-d|--date=<format>] [-l|--null[=<string>]] [-q|--quote=<char>] [-s|--separator=<char>] [-t|--datetime=<format>] [-v|--verbose] pg2evd ( --help | --usage | --version )
Options
- -d, --date=<format>
-
by default it produce no format for date, so the ENV_DEFAULT_DATE_PATTERN is then used (by default it is ‘"%Y-%m-%d"’)
- -l, --null=<string>
-
add ‘null="<string>"’ to every field
- -o, --output=<file.evd>
-
write output into file <file.evd> instead of standard output
- -q, --quote=<char>
-
add ‘quote="<char>"’ to every field
- -s, --separator=<char>
-
add ‘sep="<char>"’ to every field, except the last one
- -t, --datetime=<format>
-
by default it produce no format for datetime, so the ENV_DEFAULT_DATETIME_PATTERN is then used (by default it is ‘"%Y-%m-%d %H:%M:%S"’)
- -v, --verbose
-
print to STDERR info/debug messages
- --help
-
print this help and exit
- --usage
-
print short usage information and exit
- --version
-
print version and exit
’psql’ options:
- --dbname=<database>
-
either this or environment variable ‘PGDATABASE’ should be provided, if not, then current system username is used as psql database. If also ‘PGDATABASE’ environment variable is set, this option has preference. (This option is provided to ‘psql’ command.)
- --host=<hostname>
-
either this or environment variable ‘PGHOST’ should be provided when connecting to other host than localhost. If also ‘PGHOST’ variable is set, this option has preference. (This option is provided to ‘psql’ command.)
- --port=<port>
-
either this or environment variable ‘PGPORT’ should be provided when using other then standard port ‘5432’. (This option is provided to ‘psql’ command.)
- --psql=<psql_options>
-
all other options to be provides to psql command. See ‘man psql’ for details.
- --username=<pguser>
-
either this or environment variable ‘PGUSER’ should be provided, if not, then current system username is used as psql user. If variable ‘PGUSER’ is set, this option has preference. (This option is provided to ‘psql’ command.)
Examples
- Having ‘some_table’ in databese ‘some_db’:
id integer started date value varchar(20)
This command:
pg2evd --null="" --separator=";" some_db.some_table
will produce:
id int null="" sep=";" started date null="" sep=";" value string null="" sep="\n"