Order by not working

2021-02-16 Thread Dan Nessett
condary, ''), ',') AS email_list FROM "household_complete_data" GROUP BY household_name, street_address, city, state, zip ORDER BY household_name; The result is (only the first column is shown): household_name "Garcia" "Armstrong" "Armstrong" "Bauer" "Bauer" "Berst" "Berst" "Minch ()" "Berst" “Besel" The ORDER BY clause doesn’t seem to work properly (note: “Minch ()” is an entry for the household name that has the first name in parentheses). All through the table there are random insertions of rows that are out of order with respect to the household_name. This has me stumped. Can anyone give me a hint of what might be going wrong? Regards, Dan Nessett

Re: Order by not working

2021-02-16 Thread Dan Nessett
Thanks Peter. The listing of the result is from pg-admin 4.30 using view/edit data applied to the household_data table. In the past this has always returned the table contents in the ORDR BY sort order. Do I need to specify some preference in pg_admin to guarantee this? Dan > On Feb 16, 2021,

Re: Order by not working

2021-02-16 Thread Dan Nessett
ER BY when you query the > table. > > On 2/16/21 12:48 PM, Dan Nessett wrote: >> Thanks Peter. The listing of the result is from pg-admin 4.30 using >> view/edit data applied to the household_data table. In the past this has >> always returned the table contents in the ORD

Re: Order by not working

2021-02-16 Thread Dan Nessett
, email_list FROM "household_data" ORDER BY household_name ) TO '/tmp/household_data.csv' WITH (FORMAT CSV, HEADER); This works. Regards, Dan > On Feb 16, 2021, at 12:35 PM, David G. Johnston > wrote: > > > On Tuesday, February 16, 2021, Dan

Getting unexpected results from regexp_replace

2021-02-21 Thread Dan Nessett
I freely admit this may be my problem. Writing regular expression patterns is more an art than a skill. However, I am getting an unexpected result from regex_replace(). I have a table that is partially defined as follows (names and email addresses hidden for privacy): user_name user_emai

Re: Getting unexpected results from regexp_replace

2021-02-21 Thread Dan Nessett
Thanks. Doubling the backslashes did the trick. I tried to use the original expression without the E, but postgres threw an error and said to use the “E” version of the pattern. Dan > On Feb 21, 2021, at 8:50 AM, Tom Lane wrote: > > Dan Nessett writes: >> SELECT user_name,