SQL names for C constants - Mailing list pgsql-general

From Vegard Bønes
Subject SQL names for C constants
Date
Msg-id 45E3E49B.8020005@met.no
Whole thread Raw
Responses Re: SQL names for C constants  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-general
Hi!

I am writing a serverside function in plpgsql, which returns a part of a
large object.

To solve this problem I can do something like this:

fd := lo_open( some_oid, 262144 );
PERFORM lo_lseek( fd, index, 0 );
RETURN loread( fd, read_size );

This works well enough, but I do feel slightly uneasy about using
numbers instead of symbolic names (262144 for INV_READ and 0 for
SEEK_SET). I do especially find SEEK_SET unsettling, since this constant
is defined outside of postgresql, and it may therefore be defined to
other values than 0 on other platforms.

Am I missing something here? Is there a way to specify these names
without writing the actual numbers, or should I just close my eyes and
hope that everything will work?


thanks

VG

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: dropping a master table and all of its partitions?
Next
From: "Albe Laurenz"
Date:
Subject: Re: stored procedure optimisation...