@saltcorn/postgres 0.9.4-beta.9 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/postgres.js +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/postgres",
3
- "version": "0.9.4-beta.9",
3
+ "version": "0.9.4",
4
4
  "description": "Postgres structures for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "main": "index.js",
14
14
  "dependencies": {
15
- "@saltcorn/db-common": "0.9.4-beta.9",
15
+ "@saltcorn/db-common": "0.9.4",
16
16
  "pg": "^8.2.1",
17
17
  "pg-copy-streams": "^5.1.1"
18
18
  },
package/postgres.js CHANGED
@@ -191,10 +191,11 @@ const insert = async (tbl, obj, opts = {}) => {
191
191
  let conflict = "";
192
192
  kvs.forEach(([k, v]) => {
193
193
  if (v && v.next_version_by_id) {
194
+ valList.push(v.next_version_by_id);
194
195
  valPosList.push(
195
196
  `coalesce((select max(_version) from "${schema}"."${sqlsanitize(
196
197
  tbl
197
- )}" where id=${+v.next_version_by_id}), 0)+1`
198
+ )}" where id=$${valList.length}), 0)+1`
198
199
  );
199
200
  if (opts.onConflictDoNothing) conflict = "on conflict do nothing ";
200
201
  } else {