Search code examples
postgresqlclojuresqlkorma

How to make Korma work with Postgres FDW?


How to use SQLKorma when using Postgres' FDW commands for EXTENSION,USER MAPPING and CREATE FOREIGN TABLE ?


Solution

  • Since SQLKorma is a database-agnostic language I would be surprised if it supports anything beyond base functionality. My guess is you will need to extend it. My recommendation is to extend it with the following principles in mind:

    FDW stuff implements SQL/MED. You probably want to implement them in a way that allows other SQL/MED implementations to re-use your syntax to continue the database-agnostic aspects. So to my mind you would probably want a bottom half that implements PostgreSQL-specific conventions (like CREATE EXTENSION) and a top half that allows management of SQl/MED functionality generally with hooks for the bottom half functionality as appropriate.

    The other option is not to do this in Korma but instead to create your tables in SQL and then simply use them in Korma.