Skip to content

Commit 3e84397

Browse files
committed
Minor fixes
1 parent 15fda51 commit 3e84397

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/cloudsync.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,10 +581,9 @@ char *table_build_mergeinsert_sql (db_t *db, cloudsync_table_context *table, con
581581
}
582582

583583
char *table_build_value_sql (db_t *db, cloudsync_table_context *table, const char *colname) {
584-
char *colnamequote = "\"";
585-
586584
#if !CLOUDSYNC_DISABLE_ROWIDONLY_TABLES
587585
if (table->rowid_only) {
586+
char *colnamequote = "\"";
588587
char *sql = memory_mprintf(SQL_SELECT_COLS_BY_ROWID_FMT, colnamequote, colname, colnamequote, table->name);
589588
return sql;
590589
}

src/postgresql/cloudsync_postgresql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ cloudsync_pk_encode(PG_FUNCTION_ARGS)
891891
errmsg("cloudsync_pk_encode failed to encode primary key")));
892892
}
893893

894-
text *result = cstring_to_text_with_len(encoded, pklen);
894+
text *result = cstring_to_text_with_len(encoded, (int)pklen);
895895
cloudsync_memory_free(encoded);
896896

897897
for (int i = 0; i < argc; i++) {

src/postgresql/database_postgresql.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ int database_exec_callback (db_t *db, const char *sql, int (*callback)(void *xda
486486

487487
// Get column names
488488
for (int i = 0; i < ncols; i++) {
489-
names[i] = NameStr(tupdesc->attrs[i].attname);
489+
names[i] = NameStr(TupleDescAttr(tupdesc, i)->attname);
490490
}
491491

492492
// Process each row
@@ -711,7 +711,7 @@ int database_debug (db_t *db, bool print_result) {
711711
// PostgreSQL debug information
712712
if (print_result) {
713713
elog(DEBUG1, "PostgreSQL SPI debug info:");
714-
elog(DEBUG1, " SPI_processed: %lu", SPI_processed);
714+
elog(DEBUG1, " SPI_processed: %lu", (unsigned long)SPI_processed);
715715
elog(DEBUG1, " In transaction: %d", IsTransactionState());
716716
}
717717
return DBRES_OK;
@@ -1080,7 +1080,7 @@ int database_pk_names (db_t *db, const char *table_name, char ***names, int *cou
10801080
return DBRES_OK;
10811081
}
10821082

1083-
int n = SPI_processed;
1083+
uint64_t n = SPI_processed;
10841084
char **pk_names = cloudsync_memory_alloc(n * sizeof(char*));
10851085
if (!pk_names) return DBRES_NOMEM;
10861086

@@ -1098,7 +1098,7 @@ int database_pk_names (db_t *db, const char *table_name, char ***names, int *cou
10981098
}
10991099

11001100
*names = pk_names;
1101-
*count = n;
1101+
*count = (int)n;
11021102
return DBRES_OK;
11031103
}
11041104

@@ -1508,7 +1508,7 @@ int database_column_type (dbvm_t *vm, int index) {
15081508
if (index >= SPI_tuptable->tupdesc->natts) return DBTYPE_NULL;
15091509

15101510
if (wrapper->current_row < 0 || wrapper->current_row >= (int)SPI_processed) {
1511-
elog(DEBUG1, "databasevm_step no rows current_row=%d processed=%lu", wrapper->current_row, SPI_processed);
1511+
elog(DEBUG1, "databasevm_step no rows current_row=%d processed=%lu", wrapper->current_row, (unsigned long)SPI_processed);
15121512
return DBTYPE_NULL;
15131513
}
15141514

0 commit comments

Comments
 (0)