Skip to content
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

Renaming public schema breaks cstore #211

Open
gunicsba opened this issue Apr 3, 2019 · 1 comment
Open

Renaming public schema breaks cstore #211

gunicsba opened this issue Apr 3, 2019 · 1 comment

Comments

@gunicsba
Copy link

gunicsba commented Apr 3, 2019

If we rename public schema then hardcoded function calls won't work, so cstore tables can't be dropped. I think this is not the intended behaviour either. See #125 for reference.

dev=# drop foreign table public.gen_releases;
ERROR:  function public.cstore_clean_table_resources(oid) does not exist
LINE 1: SELECT public.cstore_clean_table_resources(v_obj.objid)
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT public.cstore_clean_table_resources(v_obj.objid)
CONTEXT:  PL/pgSQL function public_20190402_18.cstore_drop_trigger() line 10 at PERFORM

I tried to create a new cstore_server with different name but that didn't create the functions in public. Looks like I'd have to create these functions in public or move them back to public manually for all the functions.

@ljluestc
Copy link

-- Dynamic Schema Resolution
DO $$
DECLARE
    current_schema TEXT;
BEGIN
    SELECT current_schema() INTO current_schema;
    EXECUTE format('SELECT %I.cstore_clean_table_resources($1)', current_schema) USING v_obj.objid;
END $$;

-- Explicit Schema Specification
SELECT public.cstore_clean_table_resources(v_obj.objid);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants