PG_LO_WRITE(n)
β¨ pg_lo_write β bestie, we're writing to a large object π
okay so real quick vibe check: this is the PostgreSQL Tcl Interface Documentation page for pg_lo_write, and honestly? she's a little icon. short, sweet, does exactly what she says on the tin. no cap. π
πΈ NAME πΈ
pg_lo_write β write to a large object βοΈπ
π¦ SYNOPSIS π¦
pg_lo_write conn descriptor buf len
literally that's it. four little args and you're off. slay. β¨
π DESCRIPTION π
okay so here's the tea β β pg_lo_write writes at most len bytes from a variable called buf to a large object. that's the whole job. she's not doing anything extra, she's not overachieving, she's just writing your bytes where they need to go. main character energy but make it efficient. π«Ά
π ARGUMENTS π
connβ the handle of a connection to the database in which the large object lives. like, which database are we even talking about, bestie? this is that. ποΈdescriptorβ a descriptor for the large object, and it comes frompg_lo_open. you can't just make one up, iykyk. πbufβ the string to write to the large object. and listen, not a variable name β the value itself. like, the actual string, not the name of the thing holding the string. this is the one people get wrong and i'm not gonna let it be you πlenβ the maximum number of bytes to write. and here's the lil twist π: the number actually written is the smaller of this value and the length of the string. so if you're over here requesting more bytes than your string hasβ¦ she's gonna write what she's got and move on. periodt. π
π₯ RETURN VALUE π₯
the number of bytes actually written gets returned, which β ordinarily β is gonna be the same as the number you asked for. π
but in the event of an error? the return value is negative. so likeβ¦ if you see a negative number, something went wrong, and you should probably pay attention to it instead of pretending you didn't see it. π negative = not the vibe. π
β οΈ gentle reminder bestie: len is a maximum, not a promise. the return value is the truth. always check the return value. always. π«Ά
π§ see also & credits π§
ngl this page is short and iconic and that's her brand. πΈ
this absolute gem is dated 17 September 2020, and it comes to you courtesy of the PostgreSQL Tcl Interface Documentation β so go give your Tcl/Postgres setup a little kiss on the forehead for me, mkay? πβ¨π
go write those large objects. slay. π π
π¦ where this page comes from
- alpine 3.22: pgtcl-doc 3.1.0-r0 Β· BSD-3-Clause
- alpine 3.23: pgtcl-doc 3.1.1-r0 Β· BSD-3-Clause
- alpine 3.24: pgtcl-doc 3.1.1-r0 Β· BSD-3-Clause
- nixpkgs unstable: pgtcl 3.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms