selda icon indicating copy to clipboard operation
selda copied to clipboard

Cross-schema queries

Open danstn opened this issue 5 years ago • 3 comments

...or schema definition on Table level.

Is there a way to define a cross-schema queries in postgresql?

e.g.

SELECT x.a, y.b FROM s1.x JOIN s2.y ON (..)

Assessing Selda as a core lib for an existing (quite large) postgresql access.

The only way right now is via PGConnectInfo it seems.

danstn avatar Aug 20 '19 11:08 danstn

Right now, there is no way to do this. However, it looks like adding support for it would be almost trivial, possibly with the exception of migrations.

valderman avatar Aug 21 '19 15:08 valderman

Personally don't care about migrations :)

Do you think it's realistic to introduce it anytime soon @valderman? We're currently on opaleye and table defs get quite nasty with all that profunctor business going on there.

Would love to take Selda for a spin if it had multi-schema support for statements.

danstn avatar Oct 02 '19 08:10 danstn

We could absolutely get this in by the next release but, as you may have noticed, I'll be very short on time for Selda work for the next three months so I'm afraid the next release will still be a while.

I'd be happy to merge support for this if anyone else wants to do it in the meantime. It should be a relatively straightforward matter of adding a new tableWithSchema (or similar) function, an optional schema field to the Table type, and slightly alter the table name compilation functions. For SQLite, we could probably get away with just treating the schema as a prefix to the name or something.

valderman avatar Nov 19 '19 21:11 valderman