-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pg-protocol not support js-object value #2864
Comments
thanks for the report - can you include a bit more detail on how you made this bug trigger? |
CREATE TABLE public.test (
id varchar NOT NULL DEFAULT uuid_generate_v4(),
"data" jsonb NULL,
); const insertData= [{"bb": "cc"}]
const insertQuery = {
text: 'INSERT INTO public.test (data) VALUES ($1) ',
values: [ insertData ]
}
const client = await pool.connect()
try {
await client.query('BEGIN')
await client.query(insertQuery)
await client.query('COMMIT')
} catch (e) {
await client.query('ROLLBACK')
console.log(e)
}
client.release() then will get the error. it must use |
in the doc: const createTableText = `
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE TEMP TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
data JSONB
);
`
// create our temp table
await client.query(createTableText)
const newUser = [{ email: '[email protected]' }]
// create a new user
await client.query('INSERT INTO users(data) VALUES($1)', [newUser])
const { rows } = await client.query('SELECT * FROM users') if the newUser is |
See #2012. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this will treat as a error json!
if insert or update a jsonb field with js object, then will get the error.
must use
JSON.stringify(someObject)
.The text was updated successfully, but these errors were encountered: