Skip to content

Commit

Permalink
fixed warnings causing tests to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
swetavooda committed Apr 19, 2024
1 parent 3672b1b commit 94254f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- run: psql test -c 'alter database test set enable_seqscan = off'

# setup the database for testing
- run: make installcheck REGRESS="pinecone_crud pinecone_medium_create pinecone_zero_vector_insert pinecone_build_after_insert pinecone_index_metrics" REGRESS_OPTS="--dbname=test --inputdir=./test --use-existing"
- run: make installcheck REGRESS="pinecone_crud pinecone_medium_create pinecone_zero_vector_insert pinecone_build_after_insert pinecone_invalid_config pinecone_index_metrics" REGRESS_OPTS="--dbname=test --inputdir=./test --use-existing"
- if: ${{ failure() }}
run: cat regression.diffs
# mac:
Expand Down
14 changes: 12 additions & 2 deletions src/pinecone/pinecone_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@ void validate_vector_nonzero(Vector* vector) {


void pinecone_spec_validator(const PineconeOptions *opts) {
const char* spec_str = GET_STRING_RELOPTION(opts, spec);
if (opts == NULL || cJSON_Parse(spec_str) == NULL || (spec_str != NULL && strcmp(spec_str, "") == 0)){
if (opts == NULL || cJSON_Parse(GET_STRING_RELOPTION(opts, spec)) == NULL) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Invalid spec"),
errhint("Spec should be a valid JSON object e.g. WITH (spec='{\"serverless\":{\"cloud\":\"aws\",\"region\":\"us-west-2\"}}').\n \
Refer to https://docs.pinecone.io/reference/create_index")));

} else {
const char* spec_str = GET_STRING_RELOPTION(opts, spec);
if (spec_str != NULL && strcmp(spec_str, "") == 0) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Invalid spec"),
errhint("Spec should be a valid JSON object e.g. WITH (spec='{\"serverless\":{\"cloud\":\"aws\",\"region\":\"us-west-2\"}}').\n \
Refer to https://docs.pinecone.io/reference/create_index")));

}
}
}

Expand Down

0 comments on commit 94254f9

Please sign in to comment.