nouveaux json

This commit is contained in:
2025-09-17 01:37:38 +02:00
parent dae0e4aa12
commit b131af5a82
341 changed files with 47852 additions and 3 deletions

22
json/json.sql Normal file
View File

@@ -0,0 +1,22 @@
create table item (
id bigint primary key,
caracteristiques jsonb
);
DO $$
DECLARE
f TEXT;
BEGIN
FOR f IN SELECT pg_catalog.pg_ls_dir('/tmp/json')
LOOP
IF right(f, 5) = '.json' THEN
INSERT INTO item (id, caracteristiques)
VALUES (
replace(f, '.json','')::bigint,
pg_read_file('/tmp/json/' || f)::jsonb
)
ON CONFLICT (id) DO UPDATE SET caracteristiques = EXCLUDED.caracteristiques;
END IF;
END LOOP;
END;
$$ LANGUAGE plpgsql;