I’m using Wix Velo to insert data into a PostgreSQL database. Everything works except for the integer 0 and the boolean false. These values are not stored correctly in the table and are instead left empty. Here’s the situation:
PostgreSQL Table Structure:
CREATE TABLE jouw_tabel1 (
"_id",
"_createdDate" TIMESTAMP,
"_updatedDate" TIMESTAMP,
"_owner" VARCHAR(255),
"numeric_value" INTEGER,
"is_active" BOOLEAN
);
Wix Velo Code for Insert:
const records = [
{ numeric_value: 0, is_active: true },
{ numeric_value: 0, is_active: false },
{ numeric_value: 1, is_active: false }
];
wixData.bulkInsert("wix_velo_gcp_connection/jouw_tabel1", records)
.then((result) => {
console.log(`Successfully inserted ${result.inserted}`);
})
.catch((err) => {
console.error("Error:", err);
});
What Happens:
- Non-zero integers and true values are inserted correctly.
- numeric_value: 0 and is_active: false are not stored and result in empty fields in the database.
What I Know:
- If I manually insert 0 or false via a SQL prompt (outside of Wix), it works as expected.
- This suggests the issue likely lies with how Wix Velo processes and sends these values to PostgreSQL.
Troubleshooting Steps Taken:
- Verified table structure with SELECT column_name, data_type, is_nullable FROM information_schema.columns.
- Ran queries to fetch records with 0 or false values (e.g., SELECT * FROM jouw_tabel1 WHERE numeric_value = 0;). These return no results.
- Wix does not show errors during insertion, and there are no obvious logs in PostgreSQL indicating a problem.
I’m using PostgreSQL 16.6. Is there something specific in Wix Velo that could cause this behavior? How can I debug or fix this issue?
Images related to the comments of Adrian Klaver
Query Insights
Query ID: 8155776421138895221 Query text: (Truncated to 4500 characters. Customize query length.)
INSERT INTO
"jouw_tabel1" ("_id",
"_createdDate",
"_updatedDate",
"_owner",
"numeric_value",
"is_active")
VALUES
($1, $2, $3, $4, $5, $6)
Flags and Parameters
Flags allow you to customize granular aspects of your instance. Changes may require restart. 1. cloudsql.iam_authentication: on 2. log_statement: all 3. log_min_error_statement: info 4. cloudsql.enable_pgaudit: on 5. pgaudit.log_parameter: on
Images related to the answer of KikoZam
I’m using Wix Velo to insert data into a PostgreSQL database. Everything works except for the integer 0 and the boolean false. These values are not stored correctly in the table and are instead left empty. Here’s the situation:
PostgreSQL Table Structure:
CREATE TABLE jouw_tabel1 (
"_id",
"_createdDate" TIMESTAMP,
"_updatedDate" TIMESTAMP,
"_owner" VARCHAR(255),
"numeric_value" INTEGER,
"is_active" BOOLEAN
);
Wix Velo Code for Insert:
const records = [
{ numeric_value: 0, is_active: true },
{ numeric_value: 0, is_active: false },
{ numeric_value: 1, is_active: false }
];
wixData.bulkInsert("wix_velo_gcp_connection/jouw_tabel1", records)
.then((result) => {
console.log(`Successfully inserted ${result.inserted}`);
})
.catch((err) => {
console.error("Error:", err);
});
What Happens:
- Non-zero integers and true values are inserted correctly.
- numeric_value: 0 and is_active: false are not stored and result in empty fields in the database.
What I Know:
- If I manually insert 0 or false via a SQL prompt (outside of Wix), it works as expected.
- This suggests the issue likely lies with how Wix Velo processes and sends these values to PostgreSQL.
Troubleshooting Steps Taken:
- Verified table structure with SELECT column_name, data_type, is_nullable FROM information_schema.columns.
- Ran queries to fetch records with 0 or false values (e.g., SELECT * FROM jouw_tabel1 WHERE numeric_value = 0;). These return no results.
- Wix does not show errors during insertion, and there are no obvious logs in PostgreSQL indicating a problem.
I’m using PostgreSQL 16.6. Is there something specific in Wix Velo that could cause this behavior? How can I debug or fix this issue?
Images related to the comments of Adrian Klaver
Query Insights
Query ID: 8155776421138895221 Query text: (Truncated to 4500 characters. Customize query length.)
INSERT INTO
"jouw_tabel1" ("_id",
"_createdDate",
"_updatedDate",
"_owner",
"numeric_value",
"is_active")
VALUES
($1, $2, $3, $4, $5, $6)
Flags and Parameters
Flags allow you to customize granular aspects of your instance. Changes may require restart. 1. cloudsql.iam_authentication: on 2. log_statement: all 3. log_min_error_statement: info 4. cloudsql.enable_pgaudit: on 5. pgaudit.log_parameter: on
Images related to the answer of KikoZam
Share Improve this question edited Jan 21 at 19:35 Fabian asked Jan 20 at 14:24 FabianFabian 2301 gold badge5 silver badges14 bronze badges 13 | Show 8 more comments1 Answer
Reset to default 0It's possible that the PostgreSQL database schema has a default value for numeric\_value
and is\_active
that might be overriding the values being sent. Add column\_default
to specifically check the default values, if the column\_default
is NULL
, that means the column doesn't have a default value set. So make sure no default values are set for numeric\_value
and is\_active
.
Here’s the modified query:
SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'jouw_tabel1';
The result might look like this:
colum_name | data_type | is_nullable | column_default |
---|---|---|---|
_id | character varying | YES | NULL |
_createdDate | timestamp | YES | CURRENT_TIMESTAMP |
_updatedDate | timestamp | YES | CURRENT_TIMESTAMP |
_owner | character varying | YES | NULL |
numeric_value | integer | YES | NULL |
is_active | boolean | YES | NULL |
numeric_value
in that table to be empty - you have defined it asNOT NULL
. Something about your question doesn't match the reality of the situation. – Richard Huxton Commented Jan 20 at 15:26"_id"
,"_createdDate"
and"_updatedDate""
yet there are values returned for those fields. Is there an insert trigger on the table? – Adrian Klaver Commented Jan 20 at 15:56select false::boolean, 'false'::boolean, 0::integer, '0'::integer; f | f | 0 | 0
2) Postgres will not takefalse
forNULL
.false
is a known value,NULL
is unknown. 3) I understand the issue, Wix is broken. – Adrian Klaver Commented Jan 21 at 21:02