pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Thiemo Kellner <thiemo@gelassene-pferde.biz>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: dblink: could not send query: another command is already in progress
Date: Tue, 03 Apr 2018 11:28:11 +0200
Message-ID: <1522747691.2414.5.camel@cybertec.at> (raw)
In-Reply-To: <62f4ba30-6302-89af-2341-16c821427158@gelassene-pferde.biz>
References: <8d6c6faa-4878-68bf-d1b7-6b1f86c1445c@gelassene-pferde.biz>
	<1522388386.2396.2.camel@cybertec.at>
	<fc1691cf-dde4-f6fd-71f2-a92836a446f5@gelassene-pferde.biz>
	<1522401246.2396.16.camel@cybertec.at>
	<62f4ba30-6302-89af-2341-16c821427158@gelassene-pferde.biz>

Thiemo Kellner wrote:
> On 03/30/18 11:14, Laurenz Albe wrote:
> > You have to consume the result before you can send the next query.
> 
> I changed implementation but still get the same error but now different 
> context. I tried to retrieve the result but I failed
> 
> I committed the last code to its project repository at SourceForge 
> https://sourceforge.net/p/pglogger/code/HEAD/tree/
> 
> and put the code to pastebin.com
> Test calls: https://pastebin.com/xfUp9NAL
> function WRITE_MESSAGE: https://pastebin.com/LDjE0Czx
> function WRITE_MESSAGE_TO_TABLE: https://pastebin.com/vkBkehZF
> 
> [...]
> psql:testing/test.pg_sql:42: ERROR:  function 
> WRITE_MESSAGE_TO_TABLE(i_function => text, i_message => text, i_level => 
> text, i_present_user => name, i_session_user => name, 
> i_transaction_timestamp => timestamp with time zone, i_transaction_id => 
> bigint, i_server_pid => bigint, i_remote_address => inet, i_remote_port 
> => integer) does not exist
> HINT:  No function matches the given name and argument types. You might 
> need to add explicit type casts.
> CONTEXT:  Error occurred on dblink connection named 
> "PGLOGGER_CONNECTION": could not execute query.
> SQL statement "SELECT * from 
> dblink_get_result(V_DBLINK_CONNECTION_NAME) as t(ID bigint)"
> PL/pgSQL function write_message(text,text) line 126 at PERFORM
> psql:testing/test.pg_sql:42: STATEMENT:  select WRITE_MESSAGE('Test 
> WRITE_MESSAGE 2nd call', 'NOTICE');

I couldn't dig through all your code, but two things seemed suspicious:

> if (
>                 V_DBLINK_CONNECTION_NAMES is null
>              or V_DBLINK_CONNECTION_NAME != any(V_DBLINK_CONNECTION_NAMES)

I don't think you want "!=ANY" there.  Shouldn't that be "<>ALL" ?
"<>ANY" will *always* be true if there are at least two different entries.


The other thing is that you seem to call "dblink_get_result" on any existing
connection before use.  But you can only call the function if there is a
result outstanding.

One of your error messages above seems to suggest that this is your problem.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




view thread (8+ messages)  latest in thread

Message-ID: <1522747691.2414.5.camel@cybertec.at>
Permalink:  ../1522747691.2414.5.camel@cybertec.at/
Also on:    postgresql.org/message-id/1522747691.2414.5.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, thiemo@gelassene-pferde.biz
  Subject: Re: dblink: could not send query: another command is already in progress
  In-Reply-To: <1522747691.2414.5.camel@cybertec.at>
  References: <8d6c6faa-4878-68bf-d1b7-6b1f86c1445c@gelassene-pferde.biz> <1522388386.2396.2.camel@cybertec.at> <fc1691cf-dde4-f6fd-71f2-a92836a446f5@gelassene-pferde.biz> <1522401246.2396.16.camel@cybertec.at> <62f4ba30-6302-89af-2341-16c821427158@gelassene-pferde.biz> <1522747691.2414.5.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox