Insert image with relative path to the postgres table I have created following table in postgres:

CREATE TABLE public.test
(
    id bigint NOT NULL DEFAULT nextval('test_id_seq'::regclass),
    file_content oid,
    name bigint NOT NULL,
    CONSTRAINT test_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.test
    OWNER to postgres;


To put some example data via sql script:

INSERT INTO public.test(id, file_content, name) VALUES (1, lo_import('test.jpg'), 14);


It works fine when I am putting full path to binary file, like:
C:\temp\myTest\test.jpg
However if I am putting just filename (sql script exists in the same directory) then I am getting error that file does not exists.

Do you know if it is possible to execute lo_import with relative path?
It uses PGDATA by default. We can see this using Process Monitor:



You'll have to explicitly set a path if you require otherwise.