From within a bash script I tried to use a replace and a detection on a field containing a pipe like:
IF position ('|' in var) IS NOT NULL THEN ...
...REPLACE(field, '|', '#')
The data itself was loaded into the DB using the COPY statement e.g.
COPY records FROM '$datasource' WITH DELIMITER AS ',' CSV HEADER NULL as '';
I am using psql (9.1.9) and the default field separator is pipe:
#> \f
#> Field separator is "|".
Ideally I would like to SET the default limiter in a CREATE OR REPLACE function at runtime like:
...
END; \$\$ LANGUAGE plpgsql SET config_param TO '#';
OR as a seperate statement just like SET config_param TO '#';
I searched the documentation and internet for the right name of the config parameter without luck. Any help appreciated.