[Gambas-user] Postgres - obscure problem with oids

Bruce adamnt42 at gmail.com
Sat Oct 31 17:27:22 CET 2020


On 31/10/20 10:36 pm, Benoît Minisini wrote:
> Le 31/10/2020 à 04:59, Bruce a écrit :
>> I have a table ("tableext") which is an "extension" to the system 
>> pg_catalog pg_class table. tableext relates to the pg_class on 1:1 
>> basis via the pg_class OID. Inn the tableext class that oid (called 
>> "tname")
>> a) is the primary key and
>> b) has a datatype of "regclass", IOW the table displays the OID as a 
>> table name instead of an OID.
>> That is all standard stuff in postgres whwn dealing with the catalog.
>>
>> Here's my problem. In Gambas I am trying to update a row in this 
>> tableext table.
>>
>> I can get an updateable result using
>> hBuffer = $srcConn.Edit("dd.tableext", "tname = &1::regclass", 
>> txtTableName.Text)
>>
>> In other words I am forcing the integer OID from the tname. That's 
>> fine and I get an updatable cursor.
>>
>> But when I get to the hBuffer.Update point Gambas is trying to use the 
>> string tname and I cant see how to tell it to pass the ::regclass back 
>> to the postgres server, A sample db.debug output of the query it is 
>> trying to execute is:
>>
>> UPDATE "dd"."tableext"
>> SET "cat" = $$LOOKUP$$,
>>      "facade" = $$Reference$$,
>>      "is audited" = FALSE,
>>      "strength" = $$STRONG$$,
>>      "aspect" = $$Reference$$,
>>      "comments" = NULL,
>>      "disposition" = NULL,
>>      "centity" = NULL,
>>      "boclass" = $$BPGroups$$
>> WHERE "tname" = $$bpgroups$$
>>
>>
>> I need that last line to be
>>
>> WHERE "tname" = $$bpgroups$$::regclass.
>>
>> Any clues (apart from writing specific update queries which is too 
>> onerous for the number of thesse I have to do).
>>
>> tia
>> bruce
>>
> 
> You have to write your own update request.
> 
> Regards,
> 
Ah well.
;-(

b


More information about the User mailing list