sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

postgresql "DO $$ BEGIN", not generate parameter.

Open piyongcai-liucai opened this issue 7 months ago • 2 comments

What do you want to change?

query

DO $$ BEGIN
  DELETE
    FROM stage_seat
  WHERE stage_id = $1;     -- <--- HERE has parameter

  -- other sql 
END $$;

query

const resetStagePlace = `-- name: ResetStagePlace :exec
DO $$ BEGIN
  DELETE
    FROM stage_seat
  WHERE stage_id = $1;
END $$
`
//	DO $$ BEGIN
//	  DELETE
//	    FROM stage_seat
//	  WHERE stage_id = $1; -- <--- HERE has parameter
//  
//       -- other sql 
//	END $$
func (q *Queries) ResetStagePlace(ctx context.Context) error {   // <-- HERE, not generate parameter
	_, err := q.db.Exec(ctx, resetStagePlace)
	return err
}

feature request: generate parameter for "DO $$ BEGIN ... END $$".

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

piyongcai-liucai avatar Apr 29 '25 00:04 piyongcai-liucai

Same problem here

DanielRasho avatar May 15 '25 17:05 DanielRasho

Having the same issue here

esc20936 avatar May 15 '25 17:05 esc20936

Same issue

Laky-64 avatar Aug 05 '25 20:08 Laky-64