qualify the order by id
This commit is contained in:
parent
f0838b28c0
commit
2a2652e397
@ -18,7 +18,7 @@ BEGIN
|
||||
--unwrap the schema definition array
|
||||
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
|
||||
WHERE
|
||||
srce = 'PNCL'
|
||||
srce = 'PNCC'
|
||||
GROUP BY
|
||||
srce;
|
||||
|
||||
@ -35,7 +35,7 @@ BEGIN
|
||||
----------------------------------------------------do the insert-------------------------------------------------------------------------------------------
|
||||
|
||||
--the column list needs to be dynamic forcing this whole line to be dynamic
|
||||
_t := format('COPY csv_i (%s) FROM ''C:\Users\ptrowbridge\downloads\llcol.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c);
|
||||
_t := format('COPY csv_i (%s) FROM ''C:\Users\ptrowbridge\downloads\transsearchcsv.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c);
|
||||
|
||||
--RAISE NOTICE '%', _t;
|
||||
|
||||
@ -62,7 +62,7 @@ WITH pending_list AS (
|
||||
FROM
|
||||
csv_i i
|
||||
INNER JOIN tps.srce s ON
|
||||
s.srce = 'PNCL'
|
||||
s.srce = 'PNCC'
|
||||
LEFT JOIN LATERAL JSONB_ARRAY_ELEMENTS_TEXT(defn->'unique_constraint'->'fields') WITH ORDINALITY ae(e, rn) ON TRUE
|
||||
GROUP BY
|
||||
i.*,
|
||||
@ -86,7 +86,7 @@ WITH pending_list AS (
|
||||
WHERE
|
||||
t IS NULL
|
||||
ORDER BY
|
||||
id ASC
|
||||
pl.id ASC
|
||||
----this conflict is only if an exact duplicate rec json happens, which will be rejected
|
||||
----therefore, records may not be inserted due to ay matches with certain json fields, or if the entire json is a duplicate, reason is not specified
|
||||
RETURNING *
|
||||
|
Loading…
Reference in New Issue
Block a user