All,
I am having a problem loading functions from a text file into postgres
on the Windows platform. If the source code stored in the file contains
tabs, they get changed to \x09, which causes problems when the function
is executed. As an example see attached, which preserves the tabs in the
original input file, and shows a condensed version of the \df+ output.
Is there a way to force postgres to load the file exactly as is? The
command I used to load the function was similar to "psql -U postgres -d
test -f func.sql" (func.sql was the name of the original file containing
only the CREATE FUNCTION section).

Doug Knight
WSI Corp
Andover, MA USA

As stored in file loaded, with tabs:

CREATE OR REPLACE FUNCTION tcl_module_version(text) RETURNS text
        AS $_$
        set funcname $1
        append funcname "Version"
        elog DEBUG "Calling TCL function $funcname"
        return [$funcname]
$_$
        LANGUAGE pltcl;

As stored in database, tabs replaced with \x09:

       Name        | Source code
-------------------+-------------------------------------------
tcl_module_version | \r
                   : \x09set funcname $1\r
                   : \x09append funcname "Version"\r
                   : \x09elog DEBUG "Calling TCL function $funcname"\r
                   : \x09return [$funcname]\r
                   :
(1 row)
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to