typeid-sql icon indicating copy to clipboard operation
typeid-sql copied to clipboard

Supabase db diff fails

Open LucilleH opened this issue 2 years ago • 4 comments

When adding the equality operator in a supabase migration:

CREATE OR REPLACE FUNCTION compare_type_id_equality(lhs_id typeid, rhs_id VARCHAR)
    RETURNS BOOLEAN AS $$
SELECT lhs_id = typeid_parse(rhs_id);
$$ LANGUAGE SQL IMMUTABLE;

Applying migration as db reset is successful. However, all subsequent supabase db diff fails with the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1770, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedFunction: operator is only a shell: character varying = typeid
LINE 188:             case when p.data_type = 'USER-DEFINED' then
                                            ^

Should we compare the uuid part and the prefix part separately as strings?

LucilleH avatar Sep 01 '23 23:09 LucilleH

Also running into this. Any updates/workarounds?

hyldmo avatar Nov 23 '23 09:11 hyldmo

Sorry, I haven't had the time to look into this, but will take a look towards the end of this week.

loreto avatar Nov 28 '23 03:11 loreto

PR out: https://github.com/jetpack-io/opensource/pull/203

loreto avatar Nov 29 '23 00:11 loreto

Thank you so much! Works for me now at least 👍

hyldmo avatar Dec 06 '23 23:12 hyldmo