Is there a more concise way in Postgres to extract a portion of a string?
You can use regexp_replace() to replace everything after the first ? with nothing:

select regexp_replace(url, '\?.*$', '')


The following example:

with data (url) as (
   values 
    ('http://foo.bar/some/page'),
    ('http://foo.bar/some/page?id=42&amp;name=Marvin')
)
select url, regexp_replace(url, '\?.*$', '') as clean_url
from data;


returns:

url                                        | clean_url               
-------------------------------------------+-------------------------
http://foo.bar/some/page                   | http://foo.bar/some/page
http://foo.bar/some/page?id=42&amp;name=Marvin | http://foo.bar/some/page