On Thursday, May 17, 2012 7:52:04 AM UTC-7, Michael Gliwinski wrote: > > Hi All, > > Is setting default schema (via DB.default_schema=) supposed to work for > any > database? Or does it have to be supported by the adapter? > > I'm connecting to a Progress v9 database via JDBC, queries work correctly > when > specifying schema explicitly, e.g. DB[:pub__system], but:: > > DB[:pub__system] > => #<Sequel::JDBC::Dataset: "SELECT * FROM \"PUB\".\"SYSTEM\""> > > DB.default_schema = 'pub' > DB[:system] > => #<Sequel::JDBC::Dataset: "SELECT * FROM \"SYSTEM\""> > > DB.database_type is nil if that matters. > > Sorry if I'm misunderstanding how it's supposed to work. > > default_schema is mostly used in the schema modification and introspection code, not the dataset code. You may want to change the schema search path (or equivalent for Progress) on the connection if you want to use a particular schema by default in the dataset code.
The main reason for the existence of default_schema is that certain Sequel queries don't respect the database's current schema settings. For example, when parsing tables and indexes, Sequel is often accessing system metadata tables that contain information for tables in all schemas, and it currently doesn't have a way to determine what the current database default schema(s) is in order to restrict the lookup to just that schema(s). default_schema can be used in those cases so that lookups are restricted to a given schema without having to specify the schema in every call. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/C12vRHsKsEEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
