note 128100 added to function.pg-copy-from

From: Date: Sun, 08 Jan 2023 21:25:28 +0000
Subject: note 128100 added to function.pg-copy-from
Groups: php.notes 
Request: Send a blank email to php-notes+get-220054@lists.php.net to get a copy of this message
To solve the problem of how many backslashes to use for the parameters $separator and $null_as: The backslashes are interpreted twice, first by PHP and then by PostgreSQL. So write four backslashes to indicate one backslash in the input data. So both '\\\\N' and as "\\\\N" become NULL AS E'\\N' meaning the same as NULL AS '\N' in the internally used SQL statement. The loaded input data must be backslash-escaped. According to the PostgreSQL documentation, you can use the following escape sequences: \\ = Backslash (ASCII 92) \b = Backspace (ASCII 8) \t = Tab (ASCII 9) \n = Newline (ASCII 10) \v = Vertical tab (ASCII 11) \f = Form feed (ASCII 12) \r = Carriage return (ASCII 13) \000 (Backslash followed by one to three octal digits) = the byte with that numeric code \x00 (Backslash x followed by one or two hex digits) = the byte with that numeric code With the default setting, a data field containing only \N (one non-escaped backslash and an N) indicates a NULL value. This default value \N has been chosen because it does not collide with properly encoded data. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.158.213 (proxied: 84.118.87.79) ---- Manual Page -- https://php.net/manual/en/function.pg-copy-from.php Edit -- https://main.php.net/note/edit/128100 Del: integrated -- https://main.php.net/note/delete/128100/integrated Del: useless -- https://main.php.net/note/delete/128100/useless Del: bad code -- https://main.php.net/note/delete/128100/bad+code Del: spam -- https://main.php.net/note/delete/128100/spam Del: non-english -- https://main.php.net/note/delete/128100/non-english Del: in docs -- https://main.php.net/note/delete/128100/in+docs Del: other reasons-- https://main.php.net/note/delete/128100 Reject -- https://main.php.net/note/reject/128100 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220054) next »