mikluha
mikluha

Reputation: 65

What is "IsA()" function in C?

In pure C code in different projects that involve Postgresql server programming which I'm working with now, I keep encountering the function "IsA()" which returns a boolean and checks whether or not 2 instances of a struct belong to the same struct. I suppose.

One of them:

https://github.com/guotao0628/pipelinedb/blob/master/src/backend/executor/nodeBitmapAnd.c#L123

    for (i = 0; i < nplans; i++)
    {
        PlanState  *subnode = bitmapplans[i];
        TIDBitmap  *subresult;

        subresult = (TIDBitmap *) MultiExecProcNode(subnode);

        if (!subresult || !IsA(subresult, TIDBitmap))               /*what's IsA(...) ? */
            elog(ERROR, "unrecognized result from subplan");

        if (result == NULL)
            result = subresult; /* first subplan */

I need to port some of that C code to other strictly typed language. Hence, I need to know how "isA()" is implemented under the hood. But I haven't found it anywhere. Supposedly it's defined in some library.

Where can I find its definition?

Upvotes: 0

Views: 304

Answers (1)

JessePinkman
JessePinkman

Reputation: 651

IsA is a macro which is defined in this header file in Postgresql source code.

Upvotes: 2

Related Questions