Navigation Menu

Skip to content

Commit

Permalink
Change the return value type of pgroonga.ctid to cstring
Browse files Browse the repository at this point in the history
  • Loading branch information
hnakamur committed Aug 10, 2015
1 parent 4b5d9a5 commit c3c133e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pgroonga.c
Expand Up @@ -1302,14 +1302,18 @@ pgroonga_command(PG_FUNCTION_ARGS)
}

/**
* pgroonga.ctid(row record) : int64
* pgroonga.ctid(row record) : cstring
*/
Datum
pgroonga_ctid(PG_FUNCTION_ARGS)
{
HeapTupleHeader header = PG_GETARG_HEAPTUPLEHEADER(0);
uint64 tupleID = CtidToUInt64(&(header->t_ctid));
PG_RETURN_INT64((int64)tupleID);
char buf[20];
char *copiedCtid;
snprintf(buf, sizeof(buf), "%lu", tupleID);
copiedCtid = pstrdup(buf);
PG_RETURN_CSTRING(copiedCtid);
}

static grn_bool
Expand Down
2 changes: 1 addition & 1 deletion pgroonga.sql
Expand Up @@ -24,7 +24,7 @@ CREATE FUNCTION pgroonga.command(groongaCommand text)
STRICT;

CREATE FUNCTION pgroonga.ctid("row" record)
RETURNS int64
RETURNS cstring
AS 'MODULE_PATHNAME', 'pgroonga_ctid'
LANGUAGE C
VOLATILE
Expand Down

0 comments on commit c3c133e

Please sign in to comment.