@profullstack/libsql-pg 0.1.3 → 0.1.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.
package/README.md CHANGED
@@ -58,6 +58,7 @@ const tx = await db.transaction('write'); await tx.execute(...); await tx.commit
58
58
  | `lower(hex(randomblob(16)))`, `hex(randomblob(n))` | `encode(gen_random_bytes(n), 'hex')` |
59
59
  | `group_concat(x, sep)` | `string_agg(x::text, sep)` |
60
60
  | `ifnull(a, b)` | `coalesce(a, b)` |
61
+ | `x LIKE y` | `x ILIKE y` (SQLite's LIKE is case-insensitive; `NOT LIKE` and `ESCAPE` kept) |
61
62
  | `CAST(x AS INTEGER)` | `CAST(x AS BIGINT)` (SQLite's integer is 64-bit) |
62
63
  | `` `backticked` `` identifiers | `"quoted"` |
63
64
  | `PRAGMA ...` | no-op, empty result |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/libsql-pg",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Drop-in replacement for @libsql/client that talks to Postgres, plus the tools to move a Turso/libSQL database into it: the same execute/batch/transaction surface, SQLite idioms rewritten on the way through, a schema converter and a row copier.",
6
6
  "keywords": [
package/src/rewrite.js CHANGED
@@ -430,6 +430,9 @@ export function rewriteFunctions(sql) {
430
430
  return `string_agg(${distinct ? 'distinct ' : ''}(${first})::text, ${sep})`;
431
431
  });
432
432
  sql = replaceCode(sql, /\bifnull\s*\(/gi, 'coalesce(');
433
+ // SQLite's LIKE is case-insensitive (ASCII); Postgres's is not. ILIKE keeps the
434
+ // meaning every LIKE in a SQLite app relied on (NOT LIKE -> NOT ILIKE, ESCAPE kept).
435
+ sql = replaceCode(sql, /\blike\b/gi, 'ILIKE');
433
436
  sql = replaceCalls(sql, 'instr', ({ args }) => (args.length === 2 ? `position(${args[1].trim()} in ${args[0].trim()})` : null));
434
437
  sql = replaceCalls(sql, 'max', ({ args }) => (args.length >= 2 ? `greatest(${args.map((a) => a.trim()).join(', ')})` : null));
435
438
  sql = replaceCalls(sql, 'min', ({ args }) => (args.length >= 2 ? `least(${args.map((a) => a.trim()).join(', ')})` : null));