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

Extension unaccent: duplication #218

Open
vams1991 opened this issue Apr 13, 2020 · 4 comments
Open

Extension unaccent: duplication #218

vams1991 opened this issue Apr 13, 2020 · 4 comments

Comments

@vams1991
Copy link

extension unaccent:
  description: text search dictionary that removes accents
  owner: postgres
  schema: public
  version: '1.1'
text search dictionary unaccent:
    depends_on:
    - text search template unaccent
    options: rules = 'unaccent'
    owner: postgres
    template: unaccent
  text search template unaccent:
    init: public.unaccent_init
    lexize: public.unaccent_lexize

dbtoyaml seems to be be producing duplicate data(text search dictionary and template) which are already included in the extension.

Can we get a fix for this?

@jmafc
Copy link
Member

jmafc commented Apr 14, 2020

My memory is quite rusty on this but I believe this may be fixed by tweaking the queries in pyrseas/dbobject/textsearch.py. If you grep -C1 "pg_depend" in that directory, you'll see a bunch of partial queries that read (for example),

AND o.oid NOT IN (
    SELECT objid FROM pg_depend WHERE deptype = 'e'
          AND classid = 'pg_opclass'::regclass)

I think similar clauses may have to be added to the textsearch.py queries to avoid the duplicates. [OTOH, I seem to recall someone criticizing these and suggesting a better way, but as I said, I'm rusty. @dvarrazzo @rmg Does this ring a bell?]

@rmg
Copy link
Contributor

rmg commented Apr 14, 2020

Not ringing any bells for me.

@dvarrazzo
Copy link
Contributor

I remember pyrseas trying hard to avoid loading any object belonging to an extension, which means that every single query has to be special cased with a clause "and by the way, this shouldn't be fetched because belongs to an extension".

A simpler approach would be to load all the objects without caring if it belongs to an extension, and then prune away these objects down the line, and uniformly, replacing each object's dependency for an object into the extension with a dependency on the extension itself.

@jmafc
Copy link
Member

jmafc commented Apr 14, 2020

Thanks Daniele. Yes, that's part of the reason why I had opened issue #185, but that's a major undertaking. So it seems that the only short term solution is adding yet more special case clauses fo the textsearch queries.

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

4 participants