Win 11
Wappler 7.1.2
Docker local
PostgreSQL
Posting this generally rather than a bug report at this time.
Due to the issue with MySql UUID primary keys and insertions not returning the new UUID I have tried PostgreSQL for the first time as using UUIDs was preferable in my current project.
I suspect this issue is a Wappler Database Manager issue rather than Postgres itself but as i an not familiar with the platform i thought i would ask, i can always move this to bug reports if necessary. So checking i have not missed some piece of logic i am unaware of.
Can i say at this point, i already have a workaround so no need for workaround suggestions.
Also, tried AI so again, no AI sugegstions please, just real people with real experience please.
So here is the issue.
I start with two simple tables, both with primary key as UUID.
I want now, to add a foreign key to table2 for the purposed of a join.
Here is where things go wrong.
If i add a field, say table1_id as a string to Table2 and try a join i get an error.
I know why, Postgres does not cast the string to a UUID type automatically as MySql does.
So i try to add a foreign key as UUID called table1_id to table 2, NOT marking ti as a primary key.
I try to committ the change.
i get an eerror saying that i am trying to define a second primary key.
Here is the Knex file :
exports.up = function(knex) {
return knex.schema
.raw(knex.client.constructor.name.startsWith('Client_PG') ? 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"' : 'SELECT 1')
.table('table2', async function (table) {
table.uuid('table1_id').primary().defaultTo(knex.client.constructor.name.startsWith('Client_PG') ? knex.raw('uuid_generate_v4()')
: (knex.client.constructor.name.includes('MSSQL') ? knex.raw('NEWID()')
: (knex.client.constructor.name.includes('MySQL') ? knex.raw('(UUID())') : null)));
})
};
exports.down = function(knex) {
return knex.schema
.table('table2', async function (table) {
table.dropColumn('table1_id');
})
};
So i go into pgadmin4 and add the field manually

ensuring it is not set as primary
After saving i go back to wappler Databse manager where is see the correct entry now. (thats the workaround)
Is this a DB manager issue (if so i cant believe it has not been spotted before) or am i missing something?