I have a line with some spaces in it and I would like to split it into the last space and return part of the line before this space. Does Postgres support this? I could not solve this with the usual functions like split_part.Example: "fort worth tx" → "fort worth"
it does not break the original string, but does what you want:
SELECT regexp_replace('fort worth tx', '\\s\\S+$', '');
You will need to write the plpgsql function to accomplish this. Look here for a function to find the last occurrence of a string.
Source: https://habr.com/ru/post/1766453/More articles:Кто-нибудь знает способ программного создания и/или выбора речевых профилей в SAPI? - speech-recognitionHow to make WCF with the name pipe address equal to WinApi? - urlIs pure SQL available for Linq to SQL? - sqlUsing natural keys as part of equals and hashCode - javaCan I use WCF to communicate with Windows kernel software? - windowsHow to track which libraries are dynamically loaded by an application? - cКак найти первое и последнее вхождения определенного символа внутри строки в PostgreSQL - plpgsqlHow would you calculate the font point size needed to best fit a predefined area? - c #Add event to dynamically declared control - powerbuilderCase for the first character of a string - stringAll Articles