Skip to content

PgFromOnly extension add #pg_only method to identifiers #449

wants to merge 1 commit into from

2 participants


This will allow to compose PostgreSQL select * from only "table", update only "table" and delete from only "table" expressions (second attempt of #448)

I rewrote it as sequel/extensions/pg_from_only. Is it now better?
I placed tests into spec/adapters/postgres_spec.rb cause they depends on PostgreSQL connection, but may be it is not best place.

@funny-falcon funny-falcon PgFromOnly extension add #pg_only method to identifiers
  This will allow to compose PostgreSQL `select * from only "table"`,
  `update only "table"` and `delete from only "table"` expressions

This is better, but still has issues.

First, I'll need to be convinced that this feature should be included in Sequel. I still think this feature is too niche, so to convince me otherwise, you'll need to post on the sequel-talk mailing list and get the community behind your request. If a number of members in the community are in favor of including it as one of the extensions that ship with Sequel, I'll reconsider it.

Second, I don't like the current implementation. Overriding qualified_identifier_sql_append to handle this case is wrong. A PgOnlyIdentifier should not be either the qualifier or the qualified in a qualified identifier. I'm guessing you are only including that in to work around automatic qualification when joining. A better fix for that would be to refactor qualified_column_name and then after refactoring, handle the PgOnlyIdentifier case in an overridden method. I think the revised workaround I posted in #448 (using an alias to fix the qualification issue) is a better and simpler way to implement this feature.

I'm closing this now. I'll reopen it later if both issues are taken care of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.