Skip to content

plsql command works in tableplus but fails when done using goose migrations #915

Answered by mfridman
hackertron asked this question in Q&A
Discussion options

You must be logged in to vote

You need to wrap those complex statements, this might help:

https://pressly.github.io/goose/documentation/annotations/#complex-statements

e.g.,

[...]

-- +goose statementbegin
CREATE OR REPLACE FUNCTION jobs_search_trigger() RETURNS TRIGGER LANGUAGE plpgsql AS $$
DECLARE
  title_text text := COALESCE(NEW.title, '');
  description_text text := COALESCE(NEW.description, '');
  company_text text := COALESCE(NEW.company, '');
  location_text text := COALESCE(NEW.location, '');
BEGIN
  NEW.search_vector := (
    setweight(to_tsvector('english', title_text), 'A') ||
    setweight(to_tsvector('english', description_text), 'B') ||
    setweight(to_tsvector('english', company_text), 'C') ||
    se…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@hackertron
Comment options

@mfridman
Comment options

@hackertron
Comment options

Answer selected by hackertron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants