Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support pg11 call syntax #1235

Closed
davecramer opened this issue Jun 30, 2018 · 3 comments
Closed

support pg11 call syntax #1235

davecramer opened this issue Jun 30, 2018 · 3 comments

Comments

@davecramer
Copy link
Member

PostgreSQL 11 now has call func https://www.postgresql.org/docs/11/static/sql-call.html syntax

@vlsi
Copy link
Member

vlsi commented Jul 23, 2018

  1. Current implementation converts {call my_proc('whatever')} to select * from my_proc('whatever') and it fails with
ERROR: my_proc(unknown) is a procedure
To call a procedure, use CALL
  1. If PreparedStatement(CALL my_proc('whatever')).executeQuery is used, then query produces no data:
FINEST:  FE=> Parse(stmt=null,query="CALL my_proc('whatever')",oids={})
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl sendBind
FINEST:  FE=> Bind(stmt=null,portal=null)
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl sendDescribePortal
FINEST:  FE=> Describe(portal=null)
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl sendExecute
FINEST:  FE=> Execute(portal=null,limit=0)
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl sendSync
FINEST:  FE=> Sync
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl processResults
FINEST:  <=BE ParseComplete [null]
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl processResults
FINEST:  <=BE BindComplete [unnamed]
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl processResults
FINEST:  <=BE NoData
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl receiveCommandStatus
FINEST:  <=BE CommandStatus(CALL)
Jul 23, 2018 9:21:09 PM org.postgresql.core.v3.QueryExecutorImpl receiveRFQ
FINEST:  <=BE ReadyForQuery(I)
  1. When simple query mode is set (e.g. PGProperty.PREFER_QUERY_MODE.set(props, "simple"); ), then result is returned:
FINEST:  FE=> SimpleQuery(query="CALL my_proc('whatever')")
Jul 23, 2018 9:24:46 PM org.postgresql.core.v3.QueryExecutorImpl receiveFields
FINEST:  <=BE RowDescription(1)
Jul 23, 2018 9:24:46 PM org.postgresql.core.v3.QueryExecutorImpl receiveFields
FINEST:         Field(results,TEXT,65535,T)
Jul 23, 2018 9:24:46 PM org.postgresql.core.v3.QueryExecutorImpl processResults
FINEST:  <=BE DataRow(len=4)
Jul 23, 2018 9:24:46 PM org.postgresql.core.v3.QueryExecutorImpl receiveCommandStatus
FINEST:  <=BE CommandStatus(CALL)
Jul 23, 2018 9:24:46 PM org.postgresql.core.v3.QueryExecutorImpl receiveRFQ
FINEST:  <=BE ReadyForQuery(I)

@davecramer
Copy link
Member Author

An interesting option is to optimistically call the function and if that fails then retry with call procedure. We could then cache the fact that it is a procedure. This causes some transaction issues, but we could wrap it in a savepoint. or alternatively create a wrapper function to do all of this.

@davecramer
Copy link
Member Author

implemented property to allow #1560

42.3.0 Release automation moved this from To do to Done Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants