Skip to main content
links, markup, format
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

###Option 1: Let Postgres calculate and set new variables with \gset

Option 1: Let Postgres calculate and set new variables with \gset

The manual about \gset:The manual about \gset:

###Option 2: Function with dynamic SQL for repeated use

Option 2: Function with dynamic SQL for repeated use

You could use a DO statement, but (the manual againthe manual again):

We need dynamic SQL with EXECUTE. The manual about Variable SubstitutionVariable Substitution:

###Option 1: Let Postgres calculate and set new variables with \gset

The manual about \gset:

###Option 2: Function with dynamic SQL for repeated use

You could use a DO statement, but (the manual again):

We need dynamic SQL with EXECUTE. The manual about Variable Substitution:

Option 1: Let Postgres calculate and set new variables with \gset

The manual about \gset:

Option 2: Function with dynamic SQL for repeated use

You could use a DO statement, but (the manual again):

We need dynamic SQL with EXECUTE. The manual about Variable Substitution:

typo, links
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

We need dynamic SQL witwith EXECUTE. The manual about Variable SubstitutionVariable Substitution:

We need dynamic SQL wit EXECUTE. The manual about Variable Substitution:

We need dynamic SQL with EXECUTE. The manual about Variable Substitution:

typo
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
fix variable
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
added 2 characters in body
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620
Loading