COPY with dynamic file name
问题 I am trying to write a function to load csv data into a table. I want the input argument to be the path to the file. CREATE OR REPLACE FUNCTION public.loaddata(filepathname varchar) RETURNS void AS $BODY$ BEGIN COPY climatedata( climatestationid, date, prcp, prcpqflag, prcpmflag, prcpsflag, tmax, tmaxqflag, tmaxmflag, tmaxsflag, tmin, tminqflag, tminmflag, tminsflag) FROM $1 WITH csv header; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION public.filltmaxa(character varying)