Page 1 of 1

stack depth limit exceed with calling c stored procedure

Posted: Tue 01 Feb 2011 21:14
by alfrye
I have a Postgresql c language stored procedure that contains code that calls another postgresql stored procedure that uses the SPI Api. When I call the stored procedure from the PSQL command line prompt every works as desired. When attempt to call in using devart linqtoSQL I am getting an error "stack depth exceeded".

Are there setting on the context I need to be using in order to make this work.

Here is the stack trace I am getting

Code: Select all

  at Devart.Data.PostgreSql.PgSqlDataReader.e(Int32 A_0)
   at Devart.Data.PostgreSql.PgSqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)
   at Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   at Devart.Common.DbCommandBase.ExecuteNonQuery()
   at Devart.Data.Linq.Provider.DataProvider.ExecuteQuery(CompiledQuery compiledQuery, Object[] parentArgs, Object[] userArgs, Object lastResult)

Posted: Wed 02 Feb 2011 16:43
by StanislavK
Could you please describe these functions in more details? For example, please specify their return and parameter types, the actions they perform, and what exactly you mean by saying that the inner function uses the SPI API. If possible, please specify the definitions of these functions.

We couldn't reproduce the problem for simple functions.

stack depth limit exceed with calling c stored procedure

Posted: Wed 02 Feb 2011 17:33
by alfrye
I have c stored procedure defined as folllows

Code: Select all


CREATE OR REPLACE FUNCTION dbschema.upgrade_file(i_contents bytea)
RETURNS VOID 
AS '/usr/lib/postgresql/my-extensions.so.1', 'upgrade_file'
LANGUAGE C VOLATILE STRICT SECURITY INVOKER;
The c code for this stored procedure takes the information from the byte array and writes the content out. Before the code writes out any informaiton it makes a call to another postgres stored procedure to validate the user information . So inside the c code I have some code that looks like the following.

Code: Select all

SPI_connect();

SPI_execute("select public.getlogiinfo(ARRAY['currentrole'])",true,1);

SPI_finish();
If I use PGADMIN to execute the c stored procedure everything runs correctly. When I execute it using the devart libraries I get the error message. Also I was able to execute successfully from devart libraries before added the code to the c stored procedure to make the call to the other procedure to validate the user information .

Posted: Fri 04 Feb 2011 16:54
by StanislavK
Could you please send us the .c file and compiled library (preferably .dll than .so) so that we are able to reproduce and investigate the issue?