mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix up several contrib modules that were using varlena datatypes in not-so-obvious
ways. I'm not totally sure that I caught everything, but at least now they pass their regression tests with VARSIZE/SET_VARSIZE defined to reverse byte order.
This commit is contained in:
@ -215,8 +215,8 @@ _ltree_extract_isparent(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
item = (ltree *) palloc(found->len);
|
||||
memcpy(item, found, found->len);
|
||||
item = (ltree *) palloc(VARSIZE(found));
|
||||
memcpy(item, found, VARSIZE(found));
|
||||
|
||||
PG_FREE_IF_COPY(la, 0);
|
||||
PG_FREE_IF_COPY(query, 1);
|
||||
@ -238,8 +238,8 @@ _ltree_extract_risparent(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
item = (ltree *) palloc(found->len);
|
||||
memcpy(item, found, found->len);
|
||||
item = (ltree *) palloc(VARSIZE(found));
|
||||
memcpy(item, found, VARSIZE(found));
|
||||
|
||||
PG_FREE_IF_COPY(la, 0);
|
||||
PG_FREE_IF_COPY(query, 1);
|
||||
@ -261,8 +261,8 @@ _ltq_extract_regex(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
item = (ltree *) palloc(found->len);
|
||||
memcpy(item, found, found->len);
|
||||
item = (ltree *) palloc(VARSIZE(found));
|
||||
memcpy(item, found, VARSIZE(found));
|
||||
|
||||
PG_FREE_IF_COPY(la, 0);
|
||||
PG_FREE_IF_COPY(query, 1);
|
||||
@ -284,8 +284,8 @@ _ltxtq_extract_exec(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
item = (ltree *) palloc(found->len);
|
||||
memcpy(item, found, found->len);
|
||||
item = (ltree *) palloc(VARSIZE(found));
|
||||
memcpy(item, found, VARSIZE(found));
|
||||
|
||||
PG_FREE_IF_COPY(la, 0);
|
||||
PG_FREE_IF_COPY(query, 1);
|
||||
|
Reference in New Issue
Block a user