Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lC8Yp-0001ym-N7 for pgsql-general@arkaria.postgresql.org; Tue, 16 Feb 2021 22:11:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lC8Yo-0003E5-Mq for pgsql-general@arkaria.postgresql.org; Tue, 16 Feb 2021 22:11:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lC8Yo-0003CB-8d for pgsql-general@lists.postgresql.org; Tue, 16 Feb 2021 22:11:10 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lC8Yj-0004U1-1x for pgsql-general@lists.postgresql.org; Tue, 16 Feb 2021 22:11:09 +0000 Received: by mail-ot1-x330.google.com with SMTP id e5so10333996otb.11 for ; Tue, 16 Feb 2021 14:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=tzga5HZ0HpH9nIkz06vFQE/sidFGrjjBBgkZ7kOo7hs=; b=BJiUlowVVARcEMd0oZOC6jwuaykEJVMQ8dQKKV2hRDbeCtBO46hew4SAkfS50QbTDv zi8KAIbfMW4ylTqDE2GyGZ/JzSdGi7dWWG9d4w57wyNRLvgOKw6AT9NSK3jYiEAmc8j1 J9ZDVhd9OQlKPYPoeU4IcJjsoFgPqZZ00/CfkRWxcSjmdUdO610K0QW0AVxDvdwfLjoE 7y3T5w1y+5DgLA+V5lPyDNIqaABQ9BsolfOqNYzX6xCLYz2iVCw/GTymkY/zeqWdZhhX G6C/Y13V2q9AmOOQVrRyCk/+0u71t0nxKWbeZgYFM/5w3WGq0NJHJFbG0Js+3T77F2lH pMVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=tzga5HZ0HpH9nIkz06vFQE/sidFGrjjBBgkZ7kOo7hs=; b=FxWTfMAO+GBw2PjgLSgMWYKhytseIAtH9wyS+vyRXB8gv9XAut8pbtVsljNlt6GKk5 i10Bcvx16KpefPQNJf1OOUZVe8XMVW57oXjyM7eaa0aOmsp7ec81JRpexCt4r22z7n2o ABHaCSxvZ4HlVqdVOMf/1ONl4nB/Ri7/H2n2w4TyVHBr3AWBhONpVUsAZ1OB1e9/TWUn yTW2nKXqPgdl/DoN5/kjLOSYDBN3MxHDCJosotv1s1SZHZa+n/bLknF8A0/OLP8p+3Bl 9eSQaPYFplSgvDZRmX1jkw8hNV+HGCnZ/qXtIvBcZOnATpzAUt1x2Y6ABKQgy7bhpqrN l6gw== X-Gm-Message-State: AOAM531ww3GVsoMLUo1KP/8+7+0rd4zofQBR8LMyIkWuDXsbe0vfOAPC 7luZocZQCubs8MtFGR3XE3DqFwD+C76q8A== X-Google-Smtp-Source: ABdhPJzaw74E2e6KTM4Ow9MrdY/BXLm8wzKbPK8y8j3AVF5869k70wK3VWPZnqgTskWPZAWYJpkE/A== X-Received: by 2002:a9d:3de5:: with SMTP id l92mr16392138otc.227.1613513464120; Tue, 16 Feb 2021 14:11:04 -0800 (PST) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id m10sm18974otp.44.2021.02.16.14.11.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Feb 2021 14:11:03 -0800 (PST) Subject: Re: Order by not working To: pgsql-general@lists.postgresql.org References: <8D049DD1-DC0D-498B-B7C1-773C4FB82B22.ref@yahoo.com> <8D049DD1-DC0D-498B-B7C1-773C4FB82B22@yahoo.com> <39D5CE9D-B64F-420F-8260-88B6CD50DED3@datylon.com> <2DD24450-CD97-4212-89A9-3640A07B1E0C@yahoo.com> <092195EA-31B0-4EFA-B4EE-1F7F3619817C@yahoo.com> From: Ron Message-ID: Date: Tue, 16 Feb 2021 16:11:02 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <092195EA-31B0-4EFA-B4EE-1F7F3619817C@yahoo.com> Content-Type: multipart/alternative; boundary="------------176B43199B11C50B314AB642" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------176B43199B11C50B314AB642 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit SQL is only intuitive to people who've done programming... :) Also, since your table names are only composed of lower case and underscores, the double quotes are not needed. On 2/16/21 1:41 PM, Dan Nessett wrote: > Thanks to those who responded. I have solved my problem by noting the > advice to use a select with order by. In particular, I need to export the > data to a csv file anyway, so I use the following copy command: > > COPY (SELECT household_name, family_list, street_address, city, state, > zip, phone_list, 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 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 ORDR BY sort order. Do >> I need to specify some preference in pg_admin to guarantee this? >> >> >> pgAdmin4 might be keying off of the presence of an index, which this >> table doesn’t have. >> >> David J. > -- Angular momentum makes the world go 'round. --------------176B43199B11C50B314AB642 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit SQL is only intuitive to people who've done programming... :)

Also, since your table names are only composed of lower case and underscores, the double quotes are not needed.

On 2/16/21 1:41 PM, Dan Nessett wrote:
Thanks to those who responded. I have solved my problem by noting the advice to use a select with order by. In particular, I need to export the data to a csv file anyway, so I use the following copy command:

COPY (SELECT household_name, family_list, street_address, city, state, zip, phone_list, 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 <david.g.johnston@gmail.com> wrote:


On Tuesday, February 16, 2021, Dan Nessett <dnessett@yahoo.com> 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 ORDR BY sort order. Do I need to specify some preference in pg_admin to guarantee this?

pgAdmin4 might be keying off of the presence of an index, which this table doesn’t have.

David J.


--
Angular momentum makes the world go 'round.
--------------176B43199B11C50B314AB642--