'postgress - why does CREATE DOMAIN not working?
The setting: Node / express / pg
While the following works fine
CREATE TABLE blah(foo VARCHAR(128) PRIMARY KEY);
The following breaks
CREATE DOMAIN Foo VARCHAR(128);
CREATE TABLE blah(foo FOO PRIMARY KEY);
With the following error
error: input of anonymous composite types is not implemented at Parser.parseErrorMessage (.../node_modules/pg-protocol/src/parser.ts:369:69)
The node code that triggers this is (roughly):
const { Pool } = require('pg');
const pool = new Pool();
module.exports = {
query: (text, params) => pool.query(text, params),
}
called:
await db.query('CREATE DOMAIN Foo VARCHAR(128);');
await db.query('CREATE TABLE blah(foo FOO PRIMARY KEY);');
The second call crashes
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
