Copy data from text.rpt file to paste its postgresql into pgadmin

When I run:

COPY con (date,kgs) 
FROM 'H:Sir\\data\\reporting\\hi.rpt'
WITH DELIMITER ','
CSV HEADER 
    date AS 'Datum/Uhrzeit'
    kgs  AS 'Summe'

I get an error message:

WARNING:  nonstandard use of \\ in a string literal
LINE 2: FROM 'H:Sudhir\\Conair data\\TBreporting\\hi.txt'
             ^
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.

I have had this problem for quite some time. Help?

+1
source share
1 answer

This is not a mistake, this is just a warning. It has nothing to do with the contents of the file associated with the PostgreSQL parameter and the command syntax COPYyou use.

You use PostgreSQL after 8.1 with it disabled standard_conforming_strings- up to 9.1 (which is disabled by default) or a newer version when it is disabled manually.

, bob\ted, escape-, bob<tab>ted , \t .

, , SQL, escape- C-. PostgreSQL SQL. :

  • standard_conforming_strings, SQL, . PostgreSQL. E'string', .

  • standard_conforming_strings , , . .

\ \\. , "" , ( ), . PostgreSQL , , H:Sir\\data\\reporting\\hi.rpt H:Sir\\data\\reporting\\hi.rpt (, SQL spec ) H:Sir\data\reporting\hi.rpt (, PostgreSQL, ).

, . , standard_conforming_strings, E'' .

0

Source: https://habr.com/ru/post/1546511/


All Articles