-->

postgreSQL function call packet

2019-07-17 05:50发布

问题:

As postgreSQL documentation says about it's packets here a function call must send a packet with 'F' identifier to server.

So I defined a simple function and called it with select statement and after monitoring my connection port using wireshark I see no 'F' identified packet, just multiple simple query packets ('Q' identified).

Am I missing something here?

回答1:

That is a misunderstanding.

A function that is called inside a SELECT statement is part of the statement text in a Query (identifier Q) or a Parse (identifier P) message.

The part of the documentation you are referring describes the message for the fast-path interface. This is a leftover from the time before the frontend-backend protocol had support for prepared statements and was used to execute a simple function call without the overhead of having to parse an SQL statement. It is mostly obsolete now, but still used in a few places like the large object API.

If you want to see F packets with Wireshark, you have to write C code and use the PQfn function.