Thread: BUG #16482: Input as table type to function is getting failed

BUG #16482: Input as table type to function is getting failed

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      16482
Logged by:          spandana reddy
Email address:      banaspandana4@gmail.com
PostgreSQL version: 10.10
Operating system:   windows 10 enterprise
Description:

Hi Team,

One Postgres function having table type as input parameter is failing from
dot Net NPGSQL with error message as wrong data type: 16, expected 1043.
This looks like a error where wrong data type 16(bool) passed instead of
1043 (varchar) but we have verified and no such data is passed. We have also
collected the input parameters from PGSQL logs and executed the same from
PGAdmin and no issue is observed. 

Till now we faced this issue 2 times on 2 different PROD DB's where same
error message was displayed for all the functions having table types as
input parameters.

Both the times issue is resolved after backup-delete DB –create DB- Restore
with backup. From the application retry the same operation and issue is
resolved. This is very strange and even we did not believe unless issue is
resolved by restoring the DB.

We have also posted this in postgres forums after the first occurrence of
the issue  and did not get any helpful response, below is the URL for
same.
https://www.postgresql.org/message-id/CAFj8pRAV3kXhU0L2A%2BW-ocDQnQoOoYdYdRzX5e4fSax1nA%3DCGQ%40mail.gmail.com

Below is the table type structure 
CREATE TYPE public.Atype AS
(
            aa character varying,
            ab integer,
            ac uuid,
            ad uuid,
            ae character varying,
            af character varying,
            ag uuid,
            ah character varying,
            ai character varying,
            aj character varying,
            ak timestamp without time zone,
            al timestamp without time zone,
            am boolean
);
Sample input data, data ranges from 1 to 1000 rows to datatype 

(Text,248024,8a55f8ac-8b2e-4c34-a9ff-93f54f4e8c6d,82fd8a5a-aeef-4ccd-aa60-20285e110b61,null,null,2c45d320-d0b9-45ce-9b09-1d30bc8583dd,null,null,null,2020-04-01T00:00:00,2020-04-30T00:00:00,false)

Also suggest if there is any replacement of SQL dbcc checkdb in postgres.