When PostgreSQL is running pg_dump, it inserts some comments for each item, as shown below.
pg_dump
-- -- Name: my_table; Type: TABLE; Schema: account; Owner: user; Tablespace: -- CREATE TABLE my_table( id integer ); -- -- Name: my_seq; Type: SEQUENCE; Schema: account; Owner: user -- CREATE SEQUENCE my_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
Is it possible to force them to pg_dumpbe deleted (deleted)? I would like to get only:
CREATE TABLE my_table( id integer ); CREATE SEQUENCE my_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
On a UNIX operating system, I would do it like this:
pg_dump [options] mydatabase | sed -e '/^--/d' >mydatabase.dmp
Postgres 11 + ( ), ( ), , , .
, Postgres 10!
, - . , . , . Julia :
run(pipeline(`pg_dump -d test`,"testdump.sql"))
testdump.sql, . . , , @LaurenzAlbe:
run(pipeline(`cat testdump.sql`,`sed -e '/^--/d'`,"testdump2.sql"))
, , , testdump2. , .
, , @LaurenzAlbe, , . , bash Python .
2 SQL:
SQL (), . , .
SQL , , IO .
, SQL , .
PostgreSQL pg-minify, :
compress
const minify = require('pg-minify'); const fs = require('fs'); fs.readFile('./sqlTest.sql', 'utf8', (err, data) => { if (err) { console.log(err); } else { console.log(minify(data)); } });
Source: https://habr.com/ru/post/1668282/More articles:What is the difference between tf.matmul and tf.batch_matmul in Tensorflow? - tensorflowсоздание селектора символов JavaScript - javascriptObjects of immovable classes are not subject to change? - c ++How to fix this subproject path: CordovaLib error: spawn EACCES - node.jsangular2 MdDialog does not appear as a popup - angularEnable session cookies for iframes on a page in WkWebView / mobile Safari - iosБинарники добавляются в проект, когда пакет NuGet имеет значение Grpc.Core как зависимость - .nethow to enable node_modules also while 'npm pack' is npmWakanda Studio crash when there is no server path - wakandaSparkSQL CLUSTER BY table creation is not supported - hiveAll Articles