Re: [PATCHES] psql \lo_* quiet mode patch

2007-02-13 Thread Jeremy Drake
On Tue, 13 Feb 2007, Bruce Momjian wrote:


 Your patch has been added to the PostgreSQL unapplied patches list at:

   http://momjian.postgresql.org/cgi-bin/pgpatches

 It will be applied as soon as one of the PostgreSQL committers reviews
 and approves it.

This one has also already been applied.


 ---


 Jeremy Drake wrote:
  I sent this in a while back, but never heard anything about it.
 
  This patch makes psql's \lo_* commands respect the -q flag (or other
  methods of setting quiet mode) as well as HTML output mode.  This came in
  very handy when writing a regression test which uses the \lo_import
  command since it would otherwise output the OID of the new large object
  which would be different every run.
 
  Please let me know if it is ok, or if I need to do it differently.
 
  --
  Let me assure you that to us here at First National, you're not just a
  number.  You're two numbers, a dash, three more numbers, another dash
  and another number.
  -- James Estes
 Content-Description:

 [ Attachment, skipping... ]

 
  ---(end of broadcast)---
  TIP 3: Have you checked our extensive FAQ?
 
 http://www.postgresql.org/docs/faq



-- 
Computers can figure out all kinds of problems, except the things in
the world that just don't add up.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [PATCHES] psql \lo_* quiet mode patch

2007-02-13 Thread Bruce Momjian
Jeremy Drake wrote:
 On Tue, 13 Feb 2007, Bruce Momjian wrote:
 
 
  Your patch has been added to the PostgreSQL unapplied patches list at:
 
  http://momjian.postgresql.org/cgi-bin/pgpatches
 
  It will be applied as soon as one of the PostgreSQL committers reviews
  and approves it.
 
 This one has also already been applied.


Oops, thanks.

---

 
 
  ---
 
 
  Jeremy Drake wrote:
   I sent this in a while back, but never heard anything about it.
  
   This patch makes psql's \lo_* commands respect the -q flag (or other
   methods of setting quiet mode) as well as HTML output mode.  This came in
   very handy when writing a regression test which uses the \lo_import
   command since it would otherwise output the OID of the new large object
   which would be different every run.
  
   Please let me know if it is ok, or if I need to do it differently.
  
   --
   Let me assure you that to us here at First National, you're not just a
   number.  You're two numbers, a dash, three more numbers, another dash
   and another number.
 -- James Estes
  Content-Description:
 
  [ Attachment, skipping... ]
 
  
   ---(end of broadcast)---
   TIP 3: Have you checked our extensive FAQ?
  
  http://www.postgresql.org/docs/faq
 
 
 
 -- 
 Computers can figure out all kinds of problems, except the things in
 the world that just don't add up.

-- 
  Bruce Momjian  [EMAIL PROTECTED]  http://momjian.us
  EnterpriseDB   http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [pgsql-patches] [PATCHES] psql \lo_* quiet mode patch

2007-01-20 Thread Bruce Momjian

Patch applied by Neil.

---

Jeremy Drake wrote:
 I sent this in rather late in the 8.2 cycle, so now that 8.3 development
 is underway I thought I'd try sending it again.  This patch was necessary
 in the development of a large object regression test, but is logically
 seperate and reasonable even without that test, so I'm sending it in
 seperately for independant consideration.  I'll save my pushing on the
 large object test until this one gets in ;)
 
 -- Forwarded message --
 Date: Thu, 26 Oct 2006 15:58:07 -0700 (PDT)
 From: Jeremy Drake [EMAIL PROTECTED]
 To: PostgreSQL Patches pgsql-patches@postgresql.org
 Subject: [PATCHES] psql \lo_* quiet mode patch
 
 I sent this in a while back, but never heard anything about it.
 
 This patch makes psql's \lo_* commands respect the -q flag (or other
 methods of setting quiet mode) as well as HTML output mode.  This came in
 very handy when writing a regression test which uses the \lo_import
 command since it would otherwise output the OID of the new large object
 which would be different every run.
 
 Please let me know if it is ok, or if I need to do it differently.
 
 -- 
 Let me assure you that to us here at First National, you're not just a
 number.  You're two numbers, a dash, three more numbers, another dash
 and another number.
   -- James Estes
Content-Description: 

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 4: Have you searched our list archives?
 
http://archives.postgresql.org

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[PATCHES] psql \lo_* quiet mode patch

2006-12-24 Thread Jeremy Drake
I sent this in rather late in the 8.2 cycle, so now that 8.3 development
is underway I thought I'd try sending it again.  This patch was necessary
in the development of a large object regression test, but is logically
seperate and reasonable even without that test, so I'm sending it in
seperately for independant consideration.  I'll save my pushing on the
large object test until this one gets in ;)

-- Forwarded message --
Date: Thu, 26 Oct 2006 15:58:07 -0700 (PDT)
From: Jeremy Drake [EMAIL PROTECTED]
To: PostgreSQL Patches pgsql-patches@postgresql.org
Subject: [PATCHES] psql \lo_* quiet mode patch

I sent this in a while back, but never heard anything about it.

This patch makes psql's \lo_* commands respect the -q flag (or other
methods of setting quiet mode) as well as HTML output mode.  This came in
very handy when writing a regression test which uses the \lo_import
command since it would otherwise output the OID of the new large object
which would be different every run.

Please let me know if it is ok, or if I need to do it differently.

-- 
Let me assure you that to us here at First National, you're not just a
number.  You're two numbers, a dash, three more numbers, another dash
and another number.
-- James EstesIndex: src/bin/psql/large_obj.c
===
RCS file: 
/home/jeremyd/local/postgres/cvsuproot/pgsql/src/bin/psql/large_obj.c,v
retrieving revision 1.46
diff -c -r1.46 large_obj.c
*** src/bin/psql/large_obj.c29 Aug 2006 15:19:51 -  1.46
--- src/bin/psql/large_obj.c25 Sep 2006 23:02:33 -
***
*** 12,17 
--- 12,54 
  #include settings.h
  #include common.h
  
+ static void
+ print_lo_result(const char *fmt,...)
+ __attribute__((format(printf, 1, 2)));
+ 
+ static void
+ print_lo_result(const char *fmt,...)
+ {
+   va_list ap;
+ 
+   if (!pset.quiet)
+   {
+   if (pset.popt.topt.format == PRINT_HTML)
+   {
+   fputs(p, pset.queryFout);
+   // XXX should probably use html_escaped_print here
+   // but I know the strings have no bad chars
+   }
+ 
+   va_start(ap, fmt);
+   vfprintf(pset.queryFout, fmt, ap);
+   va_end(ap);
+ 
+   if (pset.popt.topt.format == PRINT_HTML)
+   fputs(/p\n, pset.queryFout);
+   else
+   fputs(\n, pset.queryFout);
+   }
+ 
+   if (pset.logfile)
+   {
+   va_start(ap, fmt);
+   vfprintf(pset.logfile, fmt, ap);
+   va_end(ap);
+   fputs(\n, pset.logfile);
+   }
+ }
+ 
  
  /*
   * Prepare to do a large-object operation.We *must* be inside a 
transaction
***
*** 129,135 
if (!finish_lo_xact(\\lo_export, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_export\n);
  
return true;
  }
--- 166,172 
if (!finish_lo_xact(\\lo_export, own_transaction))
return false;
  
!   print_lo_result(lo_export);
  
return true;
  }
***
*** 189,195 
if (!finish_lo_xact(\\lo_import, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_import %u\n, loid);
sprintf(oidbuf, %u, loid);
SetVariable(pset.vars, LASTOID, oidbuf);
  
--- 226,233 
if (!finish_lo_xact(\\lo_import, own_transaction))
return false;
  
!   print_lo_result(lo_import %u, loid);
! 
sprintf(oidbuf, %u, loid);
SetVariable(pset.vars, LASTOID, oidbuf);
  
***
*** 225,231 
if (!finish_lo_xact(\\lo_unlink, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_unlink %u\n, loid);
  
return true;
  }
--- 263,269 
if (!finish_lo_xact(\\lo_unlink, own_transaction))
return false;
  
!   print_lo_result(lo_unlink %u, loid);
  
return true;
  }

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] psql \lo_* quiet mode patch

2006-11-22 Thread Bruce Momjian

This has been saved for the 8.3 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---

Jeremy Drake wrote:
 I sent this in a while back, but never heard anything about it.
 
 This patch makes psql's \lo_* commands respect the -q flag (or other
 methods of setting quiet mode) as well as HTML output mode.  This came in
 very handy when writing a regression test which uses the \lo_import
 command since it would otherwise output the OID of the new large object
 which would be different every run.
 
 Please let me know if it is ok, or if I need to do it differently.
 
 -- 
 Let me assure you that to us here at First National, you're not just a
 number.  You're two numbers, a dash, three more numbers, another dash
 and another number.
   -- James Estes
Content-Description: 

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 3: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faq

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[PATCHES] psql \lo_* quiet mode patch

2006-10-26 Thread Jeremy Drake
I sent this in a while back, but never heard anything about it.

This patch makes psql's \lo_* commands respect the -q flag (or other
methods of setting quiet mode) as well as HTML output mode.  This came in
very handy when writing a regression test which uses the \lo_import
command since it would otherwise output the OID of the new large object
which would be different every run.

Please let me know if it is ok, or if I need to do it differently.

-- 
Let me assure you that to us here at First National, you're not just a
number.  You're two numbers, a dash, three more numbers, another dash
and another number.
-- James EstesIndex: src/bin/psql/large_obj.c
===
RCS file: 
/home/jeremyd/local/postgres/cvsuproot/pgsql/src/bin/psql/large_obj.c,v
retrieving revision 1.46
diff -c -r1.46 large_obj.c
*** src/bin/psql/large_obj.c29 Aug 2006 15:19:51 -  1.46
--- src/bin/psql/large_obj.c25 Sep 2006 23:02:33 -
***
*** 12,17 
--- 12,54 
  #include settings.h
  #include common.h
  
+ static void
+ print_lo_result(const char *fmt,...)
+ __attribute__((format(printf, 1, 2)));
+ 
+ static void
+ print_lo_result(const char *fmt,...)
+ {
+   va_list ap;
+ 
+   if (!pset.quiet)
+   {
+   if (pset.popt.topt.format == PRINT_HTML)
+   {
+   fputs(p, pset.queryFout);
+   // XXX should probably use html_escaped_print here
+   // but I know the strings have no bad chars
+   }
+ 
+   va_start(ap, fmt);
+   vfprintf(pset.queryFout, fmt, ap);
+   va_end(ap);
+ 
+   if (pset.popt.topt.format == PRINT_HTML)
+   fputs(/p\n, pset.queryFout);
+   else
+   fputs(\n, pset.queryFout);
+   }
+ 
+   if (pset.logfile)
+   {
+   va_start(ap, fmt);
+   vfprintf(pset.logfile, fmt, ap);
+   va_end(ap);
+   fputs(\n, pset.logfile);
+   }
+ }
+ 
  
  /*
   * Prepare to do a large-object operation.We *must* be inside a 
transaction
***
*** 129,135 
if (!finish_lo_xact(\\lo_export, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_export\n);
  
return true;
  }
--- 166,172 
if (!finish_lo_xact(\\lo_export, own_transaction))
return false;
  
!   print_lo_result(lo_export);
  
return true;
  }
***
*** 189,195 
if (!finish_lo_xact(\\lo_import, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_import %u\n, loid);
sprintf(oidbuf, %u, loid);
SetVariable(pset.vars, LASTOID, oidbuf);
  
--- 226,233 
if (!finish_lo_xact(\\lo_import, own_transaction))
return false;
  
!   print_lo_result(lo_import %u, loid);
! 
sprintf(oidbuf, %u, loid);
SetVariable(pset.vars, LASTOID, oidbuf);
  
***
*** 225,231 
if (!finish_lo_xact(\\lo_unlink, own_transaction))
return false;
  
!   fprintf(pset.queryFout, lo_unlink %u\n, loid);
  
return true;
  }
--- 263,269 
if (!finish_lo_xact(\\lo_unlink, own_transaction))
return false;
  
!   print_lo_result(lo_unlink %u, loid);
  
return true;
  }

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq