*
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.24 2003/03/20 06:43:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.25 2003/04/18 23:38:47 tgl Exp $
  */
 #include "postgres_fe.h"
 #include "large_obj.h"
    PQnoticeProcessor old_notice_hook;
 
    switch (SwitchVariable(pset.vars, "LO_TRANSACTION", 
-                                   "nothing", 
-                                   "commit", 
-                                   NULL))
+                          "nothing", 
+                          "commit", 
+                          NULL))
    {
-     case 1:
-       return true;
-     case 2:
-        commit = true;
+       case 1:                 /* nothing */
+           return true;
+       case 2:                 /* commit */
+           commit = true;
+           break;
    }
 
    notice[0] = '\0';
    int         status;
    bool        own_transaction;
 
-   own_transaction = VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
+   own_transaction = !VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
 
    if (!pset.db)
    {
    unsigned int i;
    bool        own_transaction;
 
-   own_transaction = VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
+   own_transaction = !VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
 
    if (!pset.db)
    {
    int         status;
    Oid         loid = atooid(loid_arg);
    char        buf[256];
-
    bool        own_transaction;
 
-   own_transaction = VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
+   own_transaction = !VariableEquals(pset.vars, "LO_TRANSACTION", "nothing");
 
    if (!pset.db)
    {
    /* XXX ought to replace this with some kind of COMMENT command */
    if (pset.issuper)
    {
-       sprintf(buf, "DELETE FROM pg_catalog.pg_description WHERE objoid = '%u' "
-               "AND classoid = 'pg_catalog.pg_largeobject'::regclass",
-               loid);
+       snprintf(buf, sizeof(buf),
+                "DELETE FROM pg_catalog.pg_description WHERE objoid = '%u' "
+                "AND classoid = 'pg_catalog.pg_largeobject'::regclass",
+                loid);
        if (!(res = PSQLexec(buf, false)))
        {
            if (own_transaction)