@ -5,23 +5,24 @@
* Copyright ( c ) 2002 , PostgreSQL Global Development Group
*
* IDENTIFICATION
* $ Header : / cvsroot / pgsql / src / backend / utils / adt / lockfuncs . c , v 1.1 2002 / 08 / 17 13 : 11 : 43 momjian Exp $
* $ Header : / cvsroot / pgsql / src / backend / utils / adt / lockfuncs . c , v 1.2 2002 / 08 / 27 04 : 00 : 28 momjian Exp $
*/
# include "postgres.h"
# include "fmgr.h"
# include "funcapi.h"
# include "catalog/pg_type.h"
# include "storage/lmgr.h"
# include "storage/lock.h"
# include "storage/lwlock.h"
# include "storage/proc.h"
Datum lock_status_srf ( PG_FUNCTION_ARGS ) ;
Datum pg_ lock_status( PG_FUNCTION_ARGS ) ;
static int next_lock ( int locks [ ] ) ;
Datum
lock_status_srf ( PG_FUNCTION_ARGS )
pg_ lock_status( PG_FUNCTION_ARGS )
{
FuncCallContext * funccxt ;
LockData * lockData ;
@ -32,7 +33,18 @@ lock_status_srf(PG_FUNCTION_ARGS)
TupleDesc tupdesc ;
funccxt = SRF_FIRSTCALL_INIT ( ) ;
tupdesc = RelationNameGetTupleDesc ( " pg_catalog.pg_locks_result " ) ;
tupdesc = CreateTemplateTupleDesc ( 5 , WITHOUTOID ) ;
TupleDescInitEntry ( tupdesc , ( AttrNumber ) 1 , " relation " ,
OIDOID , - 1 , 0 , false ) ;
TupleDescInitEntry ( tupdesc , ( AttrNumber ) 2 , " database " ,
OIDOID , - 1 , 0 , false ) ;
TupleDescInitEntry ( tupdesc , ( AttrNumber ) 3 , " backendpid " ,
INT4OID , - 1 , 0 , false ) ;
TupleDescInitEntry ( tupdesc , ( AttrNumber ) 4 , " mode " ,
TEXTOID , - 1 , 0 , false ) ;
TupleDescInitEntry ( tupdesc , ( AttrNumber ) 5 , " isgranted " ,
BOOLOID , - 1 , 0 , false ) ;
funccxt - > slot = TupleDescGetSlot ( tupdesc ) ;
funccxt - > attinmeta = TupleDescGetAttInMetadata ( tupdesc ) ;