Skip to main content
Question

PostgreSQL - Possible to trigger when Updated Row (Custom Query)


Hi, I’m quite new to Zapier and was wondering if it is possible to have an Action Trigger when a row from a custom postgreSQL query is updated? Is there a way to use the New row (custom query) trigger for this?

Would it potentially work if I changed the following postgreSQL query from “ORDER BY building_descriptions.created_at DESC” to “ORDER BY building_descriptions.updated_at DESC”?

SELECT 
--Fields
  --Properties Update
  property_users.property_id,properties.created_at,living_space,number_of_rooms,property_type,
  --Porperties New
  last_refurbished,property_condition,construction_year,
  --Adressess
  street,house_number,city,zip_code,latitude,longitude,
  --Furnishing 
  apartment_floor_begin,apartment_floor_end,apartment_type,free_from,has_balcony,has_cellar,has_garden,has_guest_toilet,has_kitchen,has_lift,has_terrace,is_barrier_free,is_handicapped_accessible,is_suitable_as_holiday_home,house_type,interior_quality,number_of_bathrooms,number_of_floors,number_of_parking_spaces,parking_space_type,plot_area,
  --Energy
energy_certificate_prior_2014,energy_certificate_status,energy_certificate_type,energy_class,energy_consumption,energy_need,heating_type,main_energy_source,warm_water_included,
  --Valuation
  is_rented,property_costs_per_month,purchase_price,rent_price,
  --Property Desciptions 
  title,description_note,furnishing_note,location_note,optional_note

--Main Table
  FROM building_descriptions 
--Joins
  LEFT JOIN property_users ON building_descriptions.property_id = property_users.property_id
  LEFT JOIN properties ON property_users.property_id = properties.id
  LEFT JOIN addresses ON properties.id = addresses.property_id
  LEFT JOIN furnishings ON properties.id = furnishings.property_id
  LEFT JOIN energies ON properties.id = energies.property_id
  LEFT JOIN valuations on properties.id = valuations.property_id

--Sort
ORDER BY building_descriptions.created_at DESC

 

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

jayeshkumarbhatia
Forum|alt.badge.img+6

Hey @nrosen ,

 

Curios to know why you are not using this trigger event ? This trigger event triggers whenever there is a new or an update on PostreSQL. 

 

 

To transform the data you can use Formatter by Zapier or Code by Zapier

 

I believe this will be much easy for you.


  • Author
  • Beginner
  • 1 reply
  • July 27, 2022

Hi @jayeshkumarbhatia,

thanks for getting back quickly. As you can see in the above query I am joining multiple tables. I don’t think that is possible with the mentioned Trigger.


Forum|alt.badge.img+4

Hi @nrosen !

Just checking in to see if you still need help with this?

You are correct, it’s not possible to use the New or Updated Row trigger for multiple tables, because you’re required to select one.

To be fully transparent, I don’t know PostgreSQL very well, so I can’t confirm if it would trigger on updated rows by using the query “ORDER BY building_descriptions.updated_at DESC”. However, I’d encourage you to give it a try and letting us know if it works. If not, at the very least we can submit a feature request for this.

 

Keep us posted!