Question

Postgres writer: is it possible to add a sql function to an attribute?

  • 13 December 2019
  • 2 replies
  • 1 view

Badge +5

Hi to all,

I'd like to add to my insert procedure a specific sql function for example add a to_tsvector(my_column). I've tried to add it in different manners but the result is always my value with the function name written in the column. Is it possibile to do what I want with a writer or I have to use an SQLExecutor and write my desired insert statemenet?

Thank you


2 replies

Userlevel 5
Badge +25

You can add a SQL query to be executed before or after writing (that's in the Navigator under the advanced writer parameters)

But that's on a per-run basis, if you want to do something per feature a SQLExecutor is probably the way to go.

Badge +5

Thank you for your reply. What I like to do is:

insert into tsearch (label,layer_name,role_id,public,ts,geom) 
values
('@Value(name)', '@Value(_layer)', 1, true, to_tsvector('@Value(name)'), geom)

With "sql to run before/after" is not possible.

I will use SQLExecutor.

Reply