On Sat, 3 Mar 2007, Bruce Momjian wrote:

>
> Patch applied.  Thanks.

Another usage of the old workaround for the flags was added with the
application of the lo_truncate patch.  This patch changes that one to be
consistent with the others.

> ---------------------------------------------------------------------------
>
>
> Jeremy Drake wrote:
> > Since I have now learned that it is possible to input values in hex in
> > postgres, I submit this patch to clean up the ugly workaround I did in the
> > largeobject regression test to try to input hex values.  It does not
> > change the functionality of the test at all, it just makes it more
> > readable.
> >
> > In detail, before when I needed to write hex values, for example
> > 0x20000 | 0x40000,
> > for the flags to lo_open, I would write it:
> > CAST((2 | 4) * 16^4 AS integer)
> >
> > Now, I write it:
> > CAST(x'20000' | x'40000' AS integer)
> >
> > which is more like the C and other language consumers of the API, and also
> > is more obvious what I am trying to do, IMHO.
> >
> >
> > --
> > Real Programs don't use shared text.  Otherwise, how can they use
> > functions for scratch space after they are finished calling them?
> Content-Description:
>
> [ Attachment, skipping... ]
>
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: Have you checked our extensive FAQ?
> >
> >                http://www.postgresql.org/docs/faq
>
>

-- 
One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination of
their C programs.
                -- Robert Firth
Index: src/test/regress/input/largeobject.source
===================================================================
RCS file: 
/home/jeremyd/local/postgres/cvsuproot/pgsql/src/test/regress/input/largeobject.source,v
retrieving revision 1.3
diff -c -r1.3 largeobject.source
*** src/test/regress/input/largeobject.source   3 Mar 2007 20:17:25 -0000       
1.3
--- src/test/regress/input/largeobject.source   3 Mar 2007 22:41:05 -0000
***************
*** 85,91 ****
  
  -- Test truncation.
  BEGIN;
! UPDATE lotest_stash_values SET fd=lo_open(loid, CAST((2 | 4) * 16^4 AS 
integer));
  
  SELECT lo_truncate(fd, 10) FROM lotest_stash_values;
  SELECT loread(fd, 15) FROM lotest_stash_values;
--- 85,91 ----
  
  -- Test truncation.
  BEGIN;
! UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS 
integer));
  
  SELECT lo_truncate(fd, 10) FROM lotest_stash_values;
  SELECT loread(fd, 15) FROM lotest_stash_values;
Index: src/test/regress/output/largeobject.source
===================================================================
RCS file: 
/home/jeremyd/local/postgres/cvsuproot/pgsql/src/test/regress/output/largeobject.source,v
retrieving revision 1.3
diff -c -r1.3 largeobject.source
*** src/test/regress/output/largeobject.source  3 Mar 2007 20:17:25 -0000       
1.3
--- src/test/regress/output/largeobject.source  3 Mar 2007 22:41:27 -0000
***************
*** 118,124 ****
  END;
  -- Test truncation.
  BEGIN;
! UPDATE lotest_stash_values SET fd=lo_open(loid, CAST((2 | 4) * 16^4 AS 
integer));
  SELECT lo_truncate(fd, 10) FROM lotest_stash_values;
   lo_truncate 
  -------------
--- 118,124 ----
  END;
  -- Test truncation.
  BEGIN;
! UPDATE lotest_stash_values SET fd=lo_open(loid, CAST(x'20000' | x'40000' AS 
integer));
  SELECT lo_truncate(fd, 10) FROM lotest_stash_values;
   lo_truncate 
  -------------
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

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

Reply via email to