99 *
1010 *
1111 * IDENTIFICATION
12- * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.38 2000/06/22 22:31:17 petere Exp $
12+ * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.39 2000/07/14 15:35:44 thomas Exp $
1313 *
1414 *-------------------------------------------------------------------------
1515 */
@@ -43,6 +43,9 @@ static bool show_timezone(void);
4343static bool reset_timezone (void );
4444static bool parse_timezone (char * );
4545
46+ static bool show_DefaultXactIsoLevel (void );
47+ static bool reset_DefaultXactIsoLevel (void );
48+ static bool parse_DefaultXactIsoLevel (char * );
4649static bool show_XactIsoLevel (void );
4750static bool reset_XactIsoLevel (void );
4851static bool parse_XactIsoLevel (char * );
@@ -434,6 +437,68 @@ reset_timezone()
434437
435438/* SET TRANSACTION */
436439
440+ static bool
441+ parse_DefaultXactIsoLevel (char * value )
442+ {
443+ #if 0
444+ TransactionState s = CurrentTransactionState ;
445+ #endif
446+
447+ if (value == NULL )
448+ {
449+ reset_DefaultXactIsoLevel ();
450+ return TRUE;
451+ }
452+
453+ #if 0
454+ if (s -> state != TRANS_DEFAULT )
455+ {
456+ elog (ERROR , "ALTER SESSION/SET TRANSACTION ISOLATION LEVEL"
457+ " can not be called within a transaction" );
458+ return TRUE;
459+ }
460+ #endif
461+
462+ if (strcasecmp (value , "SERIALIZABLE" ) == 0 )
463+ DefaultXactIsoLevel = XACT_SERIALIZABLE ;
464+ else if (strcasecmp (value , "COMMITTED" ) == 0 )
465+ DefaultXactIsoLevel = XACT_READ_COMMITTED ;
466+ else
467+ elog (ERROR , "Bad TRANSACTION ISOLATION LEVEL (%s)" , value );
468+
469+ return TRUE;
470+ }
471+
472+ static bool
473+ show_DefaultXactIsoLevel ()
474+ {
475+
476+ if (DefaultXactIsoLevel == XACT_SERIALIZABLE )
477+ elog (NOTICE , "Default TRANSACTION ISOLATION LEVEL is SERIALIZABLE" );
478+ else
479+ elog (NOTICE , "Default TRANSACTION ISOLATION LEVEL is READ COMMITTED" );
480+ return TRUE;
481+ }
482+
483+ static bool
484+ reset_DefaultXactIsoLevel ()
485+ {
486+ #if 0
487+ TransactionState s = CurrentTransactionState ;
488+
489+ if (s -> state != TRANS_DEFAULT )
490+ {
491+ elog (ERROR , "ALTER SESSION/SET TRANSACTION ISOLATION LEVEL"
492+ " can not be called within a transaction" );
493+ return TRUE;
494+ }
495+ #endif
496+
497+ DefaultXactIsoLevel = XACT_READ_COMMITTED ;
498+
499+ return TRUE;
500+ }
501+
437502static bool
438503parse_XactIsoLevel (char * value )
439504{
@@ -535,6 +600,8 @@ SetPGVariable(const char *name, const char *value)
535600 parse_date (pstrdup (value ));
536601 else if (strcasecmp (name , "timezone" )== 0 )
537602 parse_timezone (pstrdup (value ));
603+ else if (strcasecmp (name , "DefaultXactIsoLevel" )== 0 )
604+ parse_DefaultXactIsoLevel (pstrdup (value ));
538605 else if (strcasecmp (name , "XactIsoLevel" )== 0 )
539606 parse_XactIsoLevel (pstrdup (value ));
540607#ifdef MULTIBYTE
@@ -557,6 +624,8 @@ GetPGVariable(const char *name)
557624 show_date ();
558625 else if (strcasecmp (name , "timezone" )== 0 )
559626 show_timezone ();
627+ else if (strcasecmp (name , "DefaultXactIsoLevel" )== 0 )
628+ show_DefaultXactIsoLevel ();
560629 else if (strcasecmp (name , "XactIsoLevel" )== 0 )
561630 show_XactIsoLevel ();
562631#ifdef MULTIBYTE
@@ -581,8 +650,10 @@ ResetPGVariable(const char *name)
581650 reset_date ();
582651 else if (strcasecmp (name , "timezone" )== 0 )
583652 reset_timezone ();
653+ else if (strcasecmp (name , "DefaultXactIsoLevel" )== 0 )
654+ reset_DefaultXactIsoLevel ();
584655 else if (strcasecmp (name , "XactIsoLevel" )== 0 )
585- reset_XactIsoLevel ();
656+ reset_XactIsoLevel ();
586657#ifdef MULTIBYTE
587658 else if (strcasecmp (name , "client_encoding ")== 0 )
588659 reset_client_encoding ();
0 commit comments