0

just as the title says, im not sure how i should access info from a table that has a data column as oid.

im trying to store info consumed through kafka (using spring boot) into a postgres database and the only option i have right now is using @lob, which doesnt directly store the data into the table but an oid reference to a large object in a pg_largeobject table. however when trying to access the data in that table using something like 'select data from pg_largeobject' the format is not as it should be. instead of "{"$schema":"/mediawiki/recentchange/1.0.0","meta":{"uri": etc." i get "\x7b2224736368656d61223a222f6d6564696177696b692f726563656e746368616e67652f312e302e30222c226d657461223a7b22757269223a2268747470733a2f2f7777772e77696b69646174612e" and i couldnt really find valuable info online. or at least if i could use a replacement for @Lob that would be nice.

i tried to not use lob but i either got exceptions thrown or the encoding would be WIN1252 instead of utf8. i tried using columnDefinition=text/varchar and some settings for application.properties. when trying to use lo_get(cast i get "No function matches the given name and argument types..."

steven stonie
  • 26
  • 1
  • 3
  • The alternatives you have tried are all specified too vaguely to speculate on why they didn't work. – jjanes Apr 12 '23 at 16:53
  • `lo_get(cast` is not a coherent code fragment. Give a more complete code fragment, formatted as code, and give the *complete* error message. – jjanes Apr 12 '23 at 16:57
  • 1
    Read [LO-funcs](https://www.postgresql.org/docs/current/lo-funcs.html) and for the overall view see [Large Objects](https://www.postgresql.org/docs/current/largeobjects.html). – Adrian Klaver Apr 12 '23 at 18:20
  • for the lo_get query in postgres is used select lo_get(cast(columnName as bigint)) FROM tableName where id = 43005; – steven stonie Apr 13 '23 at 08:41

0 Answers0