I have a table containing paths of csv files as well as a boolean indicated if the file has already been loaded to the database. I would like to load each of those csv's and if successful switch the boolean indicator "loaded" of the corresponding entry to TRUE in the file list.
The table containing the fienames looks as follows:
CREATE TABLE files
(
id serial,
path varchar(256),
loaded bool DEFAULT FALSE,
PRIMARY KEY (id)
)
It's really important that the loaded parameter in the files table only gets switched to TRUE if the csv has indeed been loaded. There are some mis-formed csv files which I expect to throw errors.
generated always as identity