Browse files

FAQ note about PG11 stored procedures

  • Loading branch information...
roji committed Sep 23, 2018
1 parent 0a21b25 commit b3ca24f63ff6761394e94911331bfe97eebbeb7d
Showing with 6 additions and 0 deletions.
  1. +6 −0 doc/
@@ -1,5 +1,11 @@
### <a name="stored_procedures">How can I call a PostgreSQL 11 stored procedure? I tried doing so with CommandType.StoredProcedure and got an error...</a>
PostgreSQL 11 stored procedures can be called, but unfortunately not with `CommandType.StoredProcedure`. PostgreSQL has supported stored *functions* for a long while, and since these have acted as replacements for non-existing procedures, Npgsql's `CommandType.StoredProcedure` has been implemented to invoke them; this means that `CommandType.StoredProcedure` translates into `SELECT * FROM my_stored_function()`. The new stored procedures introduce a special invocation syntax - `CALL my_stored_procedure()` - which is incompatible with the existing stored function syntax.
On the brighter side, it's very easy to invoke stored procedures (or functions) yourself - you don't really need `CommandType.StoredProcedure`. Simply create a regular command and set `CommandText` to `CALL my_stored_procedure(@p1, @p2)`, handling parameters like you would any other statement. In fact, with Npgsql and PostgreSQL, `CommandType.StoredProcedure` doesn't really have any added value over constructing the command yourself.
### <a name="unknown_type">I get an exception "The field field1 has a type currently unknown to Npgsql (OID XXXXX). You can retrieve it as a string by marking it as unknown".</a>
Npgsql has to implement support for each PostgreSQL type, and it seems you've stumbled upon an unsupported type.

0 comments on commit b3ca24f

Please sign in to comment.