Skip to main content
Question

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

  • December 13, 2019
  • 2 replies
  • 20 views

giosp
Contributor
Forum|alt.badge.img+7
  • Contributor
  • 51 replies

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3701 replies
  • December 13, 2019

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.


giosp
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • 51 replies
  • December 13, 2019

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.