More verbose, but also more consistent.

This commit is contained in:
2026-10-18 14:35:34 +02:00
parent 26999d690f
commit ed5ac7c57d
6 changed files with 428 additions and 283 deletions
@@ -0,0 +1,145 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO access_tokens (id, user_id, user_app_id, secret_hash, expires_at, issued_at)\n VALUES ($1, $2, $3, $4, $5, $6)\n ON CONFLICT (id) DO UPDATE SET\n secret_hash = access_tokens.secret_hash,\n expires_at = access_tokens.expires_at,\n issued_at = access_tokens.issued_at\n WHERE access_tokens.user_id = EXCLUDED.user_id\n AND access_tokens.user_app_id IS NOT DISTINCT FROM EXCLUDED.user_app_id\n AND access_tokens.secret_hash <> EXCLUDED.secret_hash\n RETURNING WITH (OLD AS old_row, NEW AS new_row)\n old_row.id AS \"old_id?\",\n COALESCE(old_row.user_id, new_row.user_id) AS \"old_user_id!\",\n old_row.user_app_id AS \"old_user_app_id?\",\n COALESCE(old_row.secret_hash, new_row.secret_hash) AS \"old_secret_hash!\",\n COALESCE(old_row.expires_at, new_row.expires_at) AS \"old_expires_at!\",\n COALESCE(old_row.issued_at, new_row.issued_at) AS \"old_issued_at!\",\n new_row.id AS \"id!\",\n new_row.user_id AS \"user_id!\",\n new_row.user_app_id AS \"user_app_id?\",\n new_row.secret_hash AS \"secret_hash!\",\n new_row.expires_at AS \"expires_at!\",\n new_row.issued_at AS \"issued_at!\"\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "old_id?",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "access_tokens",
"name": "id"
}
}
},
{
"ordinal": 1,
"name": "old_user_id!",
"type_info": "Uuid",
"origin": "Expression"
},
{
"ordinal": 2,
"name": "old_user_app_id?",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "access_tokens",
"name": "user_app_id"
}
}
},
{
"ordinal": 3,
"name": "old_secret_hash!",
"type_info": "Bytea",
"origin": "Expression"
},
{
"ordinal": 4,
"name": "old_expires_at!",
"type_info": "Timestamptz",
"origin": "Expression"
},
{
"ordinal": 5,
"name": "old_issued_at!",
"type_info": "Timestamptz",
"origin": "Expression"
},
{
"ordinal": 6,
"name": "id!",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "access_tokens",
"name": "id"
}
}
},
{
"ordinal": 7,
"name": "user_id!",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "access_tokens",
"name": "user_id"
}
}
},
{
"ordinal": 8,
"name": "user_app_id?",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "access_tokens",
"name": "user_app_id"
}
}
},
{
"ordinal": 9,
"name": "secret_hash!",
"type_info": "Bytea",
"origin": {
"Table": {
"table": "access_tokens",
"name": "secret_hash"
}
}
},
{
"ordinal": 10,
"name": "expires_at!",
"type_info": "Timestamptz",
"origin": {
"Table": {
"table": "access_tokens",
"name": "expires_at"
}
}
},
{
"ordinal": 11,
"name": "issued_at!",
"type_info": "Timestamptz",
"origin": {
"Table": {
"table": "access_tokens",
"name": "issued_at"
}
}
}
],
"parameters": {
"Left": [
"Uuid",
"Uuid",
"Uuid",
"Bytea",
"Timestamptz",
"Timestamptz"
]
},
"nullable": [
false,
null,
true,
null,
null,
null,
false,
false,
true,
false,
false,
false
]
},
"hash": "952c2e15628f93a5d08cd2ebd0510443d21644fdbc878069eda6959677b220ec"
}