Skip to content

fix: add missing $27 placeholder for traces column in bulk food import#1427

Merged
CodeWithCJ merged 1 commit into
CodeWithCJ:mainfrom
o-Oby:fix/bulk-import-missing-traces-placeholder
Jun 4, 2026
Merged

fix: add missing $27 placeholder for traces column in bulk food import#1427
CodeWithCJ merged 1 commit into
CodeWithCJ:mainfrom
o-Oby:fix/bulk-import-missing-traces-placeholder

Conversation

@o-Oby

@o-Oby o-Oby commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description

What problem does this PR solve?
The createFoodsInBulk INSERT query for food_variants listed 29 target columns but only 28 value expressions, causing PostgreSQL error: INSERT a plus de colonnes cibles que d expressions.

How did you implement the solution?
Added the missing $27 placeholder for the traces column in the VALUES clause.

Linked Issue: N/A (bug found during usage)

How to Test

  1. Check out this branch and run pnpm run validate in SparkyFitnessServer/
  2. Import foods via CSV using the bulk import feature
  3. Verify that the import completes without SQL errors

PR Type

  • Issue (bug fix)
  • New Feature
  • Refactor
  • Documentation

Checklist

All PRs:

  • [MANDATORY - ALL] Integrity & License: I certify this is my own work, free of malicious code, and I agree to the License terms.

Backend changes (SparkyFitnessServer/):

  • [MANDATORY for Backend changes] Code Quality: I have run typecheck, lint, and tests. New files use TypeScript, new endpoints have Zod schemas, and new endpoints include tests.
  • [MANDATORY for Backend changes] Database Security: I have updated rls_policies.sql for any new user-specific tables.

Notes for Reviewers

Single-character fix: the parameter array already provided variant.traces as the 27th element, but the SQL VALUES clause jumped from $26 directly to now(), now(), skipping the traces column entirely. No schema or logic changes needed.

The createFoodsInBulk INSERT INTO food_variants query listed 29 target
columns (including 'traces') but only provided 28 value expressions
($1–$26 + now() + now()), causing a PostgreSQL error:
  'INSERT a plus de colonnes cibles que d expressions'

Add the missing $27 placeholder so the parameter array (which already
supplies variant.traces as the 27th element) is correctly bound.
@github-actions github-actions Bot added backend bug Something isn't working labels Jun 2, 2026
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

PR Validation Results

Change Detection

  • ⚙️ Backend changes detected

⚠️ Recommendations (1)

  • Please link a related GitHub issue (Linked Issue: Closes #123).

✅ All required checks passed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the SQL query within the createFoodsInBulk function in SparkyFitnessServer/models/food.ts to include an additional parameter placeholder ($27) in the VALUES clause, ensuring the query matches the number of columns being inserted. There are no review comments, and I have no further feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@CodeWithCJ

CodeWithCJ commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Thanks for your PR. The table previously had user_id which was removed in the previous PR. It could be the culprit .
I'm not sure about the traces placeholder column. If this something else, I'll look into it later today

@CodeWithCJ CodeWithCJ merged commit 556a902 into CodeWithCJ:main Jun 4, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants