[Question] Are composite types defined in PostgreSQL supported by SQLProvider?

オープン
#427 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
fsharp, postgresql
領域
databases

調査の方向性

PostgreSQLTests.fsx から始め、SQLProvider がストアドプロシージャのパラメーターをどのように検出して表現するかを追跡します。報告されている複合型のシグネチャを、既存の PostgreSQL 型の例および Npgsql の回避策と比較します。複合型がサポートされているかを明らかにし、必要なマッピングまたは制限を文書化またはテストできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement postgresql
Description

Database has composite types defined which are input/output types to stored procedures. I am attempting to call the said procedure with input parameters. SqlProvider does not see the input parameter and assumes it is a void function.

Repro steps

The composite type defined in the database is

CREATE TYPE product_t AS
   (name text,
    product_type text)

The signature of procedure in the database is

create or replace function func_iproduct( p product_t ) returns void as

On .NET side (F#), I have created a type

type PgProductType(Name:string,ProductType:string)=
  member this.Name = Name 
  member this.ProductType = ProductType
  new() = PgProductType("","")

I believe there should be a way in which I could tell SqlProvider how to map PgProductType to product_t; not sure if this is required or such mapping is automatic. If required, an example how do I go about doing it would be helpful. Without this mapping, if I attempt to execute the procedure, the error message it reports back indicates that SqlProvider does NOT see the input parameter;

let prd = new PgProductType("F#Product","")
ctx.Functions.FuncIproduct.Invoke(prd)

stdin(29,1): error FS0501: The member or object constructor 'Invoke' takes 0 argument(s) but is here given 1. The required signature is 'SqlDataProvider<...>.dataContext.Functions.FuncIproduct.Result.Invoke() : Unit'.

Question

  1. Can I use postgresql composite types? If so, an illustrative example would help.The test suite PostgreSQLTests.fsx does not contain an example to map custom types (though there are examples to map pre-defined postgresql types).
  2. Any alternative solution short of re-implementing queries (using query expressions) foregoing the existing procedures?
Known workarounds

Directly use Npgsql

Related information
  • PostgreSQL 9.6
  • Win 7
主要言語
F#
スター
627
フォーク
147
平均マージ
2時間 2分
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fsprojects/SQLProvider のほかの issue

fsprojects/SQLProvider の issue をすべて見る

似ている issue

Databases の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。