Skip to content

Commit a6f9dc0

Browse files
committed
WIP 0.0.1
1 parent 14e8931 commit a6f9dc0

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

src/backend/utils/adt/misc.c

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,45 @@ typedef struct
372372
Datum
373373
pg_objs_per_tablespace(PG_FUNCTION_ARGS)
374374
{
375-
int teste = 1;
376-
return teste;
375+
FuncCallContext *funcctx;
376+
char *values[3];
377+
HeapTuple tuple;
378+
379+
if (SRF_IS_FIRSTCALL())
380+
{
381+
MemoryContext oldcontext;
382+
TupleDesc tupdesc;
383+
384+
funcctx = SRF_FIRSTCALL_INIT();
385+
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
386+
387+
tupdesc = CreateTemplateTupleDesc(3, false);
388+
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word",
389+
TEXTOID, -1, 0);
390+
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catcode",
391+
CHAROID, -1, 0);
392+
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "catdesc",
393+
TEXTOID, -1, 0);
394+
395+
funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);
396+
397+
MemoryContextSwitchTo(oldcontext);
398+
}
399+
400+
funcctx = SRF_PERCALL_SETUP();
401+
402+
if (funcctx->call_cntr < 10)
403+
{
404+
values[0] = "Teste";
405+
values[1] = "C";
406+
values[2] = "Testando";
407+
408+
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
409+
410+
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
411+
}
412+
413+
SRF_RETURN_DONE(funcctx);
377414
}
378415

379416
Datum

src/include/catalog/pg_proc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4279,7 +4279,7 @@ DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 1 0 0 0 f f f f t f i
42794279
DATA(insert OID = 2556 ( pg_tablespace_databases PGNSP PGUID 12 1 1000 0 0 f f f f t t s s 1 0 26 "26" _null_ _null_ _null_ _null_ _null_ pg_tablespace_databases _null_ _null_ _null_ ));
42804280
DESCR("get OIDs of databases in a tablespace");
42814281

4282-
DATA(insert OID = 2579 ( pg_obj_per_tablespace PGNSP PGUID 12 0 0 0 0 f f f f t t s s 1 0 22 "" _null_ _null_ _null_ _null_ _null_ pg_objs_per_tablespace _null_ _null_ _null_ ));
4282+
DATA(insert OID = 2579 ( pg_objs_per_tablespace PGNSP PGUID 12 1 0 0 0 f f f f t t s s 1 0 2249 "26" _null_ _null_ _null_ _null_ _null_ pg_objs_per_tablespace _null_ _null_ _null_ ));
42834283
DESCR("get OIDs objects per database and tablespace");
42844284

42854285
DATA(insert OID = 2557 ( bool PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 16 "23" _null_ _null_ _null_ _null_ _null_ int4_bool _null_ _null_ _null_ ));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy