some issue in plpgsq - exec code? - Mailing list pgsql-hackers

From Pavel Stehule
Subject some issue in plpgsq - exec code?
Date
Msg-id 162867791002210935q3b9b7225h61af2c8c6cf344f5@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hello

I am looking on code in pl_exec.c file.

I see one issue:

/* ----------* exec_run_select            Execute a select query* ----------*/
static int
exec_run_select(PLpgSQL_execstate *estate,            PLpgSQL_expr *expr, long maxtuples, Portal *portalP)
{ParamListInfo paramLI;int            rc;
/* * On the first call for this expression generate the plan */if (expr->plan == NULL)    exec_prepare_plan(estate,
expr,0); ....
 
rc = SPI_execute_plan_with_paramlist(expr->plan, paramLI,                                     estate->readonly_func,
maxtuples);if(rc != SPI_OK_SELECT)    ereport(ERROR,            (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("query\"%s\" is not a SELECT", expr->query)));
 

....
}

the test of rc is too restrict.

I think so rc could be one from: SPI_OK_SELECT,
SPI_OK_INSERT_RETURNING:, SPI_OK_UPDATE_RETURNING:,
SPI_OK_DELETE_RETURNING - and errmsg "query %s doesn't return a table"

with this change we can reuse this rutine and maybe little bit compress code.

Regards
Pavel Stehule


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: scheduler in core
Next
From: Robert Haas
Date:
Subject: Re: getting to beta