Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make imgsmlr compatible with PostgreSQL 16#16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
mperice wants to merge2 commits intopostgrespro:master
base:master
Choose a base branch
Loading
frommperice:feature/psql-16-compatibility
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionsimgsmlr.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,11 @@
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#ifdef PG_VERSION_NUM
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif
#endif

#include "c.h"
#include "fmgr.h"
Expand Down
10 changes: 10 additions & 0 deletionsimgsmlr.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,3 +37,13 @@ typedef struct
#define CHECK_SIGNATURE_KEY(key) Assert(VARSIZE_ANY_EXHDR(key) == sizeof(Signature) || VARSIZE_ANY_EXHDR(key) == 2 * sizeof(Signature));

#endif /* IMGSMLR_H */


#ifndef FALSE
#define FALSE (0)
#endif


#ifndef TRUE
#define TRUE (!FALSE)
#endif
36 changes: 23 additions & 13 deletionsimgsmlr_idx.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,13 @@
*-------------------------------------------------------------------------
*/
#include "postgres.h"

#ifdef PG_VERSION_NUM
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif
#endif

#include "fmgr.h"
#include "imgsmlr.h"
#include "access/gist.h"
Expand DownExpand Up@@ -77,19 +84,22 @@ signature_compress(PG_FUNCTION_ARGS)
Datum
signature_decompress(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
bytea *key = DatumGetByteaP(PG_DETOAST_DATUM(entry->key));

if (key != DatumGetByteaP(entry->key))
{
GISTENTRY *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));

gistentryinit(*retval, PointerGetDatum(key),
entry->rel, entry->page,
entry->offset, FALSE);
PG_RETURN_POINTER(retval);
}
PG_RETURN_POINTER(entry);
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
bytea *detoastedKey = DatumGetByteaP(entry->key);
bytea *key = (bytea *) entry->key;

// Variable key is the original entry->key before detoasting, and it’s compared with the
// detoasted key. If they’re different, a new GISTENTRY is created. Otherwise, the original entry is returned.
if (key != detoastedKey)
{
GISTENTRY *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));

gistentryinit(*retval, PointerGetDatum(key),
entry->rel, entry->page,
entry->offset, FALSE);
PG_RETURN_POINTER(retval);
}
PG_RETURN_POINTER(entry);
}

Datum
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp