stack depth limit exceed with calling c stored procedure

stack depth limit exceed with calling c stored procedure

Postby alfrye » Tue 01 Feb 2011 21:14

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)
alfrye
 
Posts: 16
Joined: Wed 05 May 2010 19:39

Postby StanislavK » Wed 02 Feb 2011 16:43

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.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

stack depth limit exceed with calling c stored procedure

Postby alfrye » Wed 02 Feb 2011 17:33

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 .
alfrye
 
Posts: 16
Joined: Wed 05 May 2010 19:39

Postby StanislavK » Fri 04 Feb 2011 16:54

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?
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for PostgreSQL