mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 14:46:56 +08:00
Require unused to be 0
This commit is contained in:
@@ -244,14 +244,20 @@ vector_recv(PG_FUNCTION_ARGS)
|
|||||||
int32 typmod = PG_GETARG_INT32(2);
|
int32 typmod = PG_GETARG_INT32(2);
|
||||||
Vector *result;
|
Vector *result;
|
||||||
int16 dim;
|
int16 dim;
|
||||||
|
int16 unused;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dim = pq_getmsgint(buf, sizeof(int16));
|
dim = pq_getmsgint(buf, sizeof(int16));
|
||||||
pq_getmsgint(buf, sizeof(int16)); /* unused */
|
unused = pq_getmsgint(buf, sizeof(int16));
|
||||||
|
|
||||||
CheckDim(dim);
|
CheckDim(dim);
|
||||||
CheckExpectedDim(typmod, dim);
|
CheckExpectedDim(typmod, dim);
|
||||||
|
|
||||||
|
if (unused != 0)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_DATA_EXCEPTION),
|
||||||
|
errmsg("expected unused to be 0, not %d", unused)));
|
||||||
|
|
||||||
result = InitVector(dim);
|
result = InitVector(dim);
|
||||||
for (i = 0; i < dim; i++)
|
for (i = 0; i < dim; i++)
|
||||||
result->x[i] = pq_getmsgfloat4(buf);
|
result->x[i] = pq_getmsgfloat4(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user