Sqlfluff lint error COPY 'unparsable' WITH - postgresql

Sqlfluff is giving me an error on this line
COPY tableName FROM './var/lib/postgresql/data/short.CSV' WITH CSV QUOTE AS '"';
lint error:
L: 53 | P: 73 | PRS | Line 53, Position 73: Found unparsable section: ' WITH
| CSV QUOTE AS \'"\''
If I run it in the query console it works correctly and if remove "with" lint pass, try with DELIMITER and same error. IDK what happens.

Related

I have installed flutter by snap ubuntu and then when I run flutter in terminal this error happens

parse error: Invalid numeric literal at line 1, column 6
parse error: Invalid numeric literal at line 1, column 6
jq: error: syntax error, unexpected ')' (Unix shell quoting issues?) at , line 1:
[.releases[] | select(.hash==)][0].archive
jq: 1 compile error
Downloading /
curl: (3) malformed
tar: latest_stable.tar.xz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Flutter initialization failed
Could not find working copy of Flutter
Unfortunately I live in Iran and I have changed my IP and it worked

Importing Large File txt Postgres

I am trying to import txt file using copy, but it won't work and getting error code
ERROR: program "cmd /c "type d:/this/all.txt"" failed
DETAIL: child process exited with exit code 1
SQL state: 38000
And try any code that I found but can't find answer, this my code
copy tablename (a, b, c, d) from program 'cmd /c "type d:/this/all.txt"' with ( format text, delimiter '|' );

Copy from HDD to table

I'm attempting to copy files from C: drive to a table in postgresql but there is a syntax error that I cannot resolve.
COPY address_alias_type_aut
C:\GNAF\Authority Code\Authority_Code_ADDRESS_ALIAS_TYPE_AUT_psv.csv' DELIMITER '|' CSV HEADER;
But it will not run:
ERROR: syntax error at or near "C"
LINE 3: C:\GNAF\Authority Code\Authority_Code_ADDRESS_ALIAS_TYPE_AUT...
^
SQL state: 42601
Character: 30
I've searched this forum and found reference to escape backslashes and slashes but neither works as per:
ERROR: syntax error at or near "C"
LINE 1: COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\A...
^
SQL state: 42601
Character: 34
and
ERROR: syntax error at or near "C"
LINE 1: COPY address_alias_type_aut from C://GNAF//Authority Code//A...
^
SQL state: 42601
Character: 34
COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRESS_ALIAS_TYPE_AUT_psv.csv' DELIMITER '|' CSV HEADER;
COPY address_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRESS_TYPE_AUT_psv.csv' DELIMITER '|' CSV HEADER;
Results for each version - single forward or backslash, and double forward or backslash is the same - error at C

Postgresql Copy Syntax error

While running copy command on Postgresql I am getting SQL syntax error. Please find below command.
COPY analyte (id, name, normal_max, normal_min, unit_of_measure, version, category, data_type) FROM stdin;
16 Cholesterol - HDL (Good) \N 40 mg/dl 0 3 9
\.
Error
ERROR: syntax error at or near "16"
LINE 2: 16 Cholesterol - HDL (Good) \N 40 mg/dl 0 3 9
^
********** Error **********
ERROR: syntax error at or near "16"
SQL state: 42601
Character: 109
This script format - a COPY FROM stdin statement followed by a stream of data - is designed to be executed by psql. Most other tools (e.g. pgAdmin) won't know what to do with it.
I'm guessing this script came from pg_dump. If you want something which you can run without psql, you can use pg_dump --column-inserts to dump the table as a series of INSERT statements instead of a COPY.

syntax error for copy command in postgresql

I used the command:
COPY studentapp_deg_course_cat(degree_code, specialization, category_level1, category_level2, category_level3, min_credit, max_credit, primary)
FROM '/home/abhishek/Downloads/courses.csv'
USING DELIMITERS ';'
and i am getting the following error:
ERROR: syntax error at or near "COPY" LINE 1: COPY studentapp_deg_course_cat(degree_code, specialization,...
^
********** Error **********
ERROR: syntax error at or near "COPY" SQL state: 42601 Character: 1
I would like to know the error in my code
Valid COPY syntax for version 9.1 on Linux should be:
COPY studentapp_deg_course_cat(degree_code, specialization, category_level1,
category_level2, category_level3, min_credit, max_credit, "primary")
FROM '/home/abhishek/Downloads/courses.csv'
WITH (DELIMITER ';')
WITH, not USING.
DELIMITER instead of DELIMITERS.
And do not use primary as column name. It's a reserved word.