Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvmBi-007IFD-O0 for pgsql-novice@arkaria.postgresql.org; Wed, 25 Oct 2023 22:17:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvmBh-0098G5-7p for pgsql-novice@arkaria.postgresql.org; Wed, 25 Oct 2023 22:17:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvmBg-0098Fh-SD for pgsql-novice@lists.postgresql.org; Wed, 25 Oct 2023 22:17:16 +0000 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qvmBd-002oM8-TH for pgsql-novice@lists.postgresql.org; Wed, 25 Oct 2023 22:17:16 +0000 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-581e92f615fso172044eaf.2 for ; Wed, 25 Oct 2023 15:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698272231; x=1698877031; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=unkegeJylmQqW6o0QisNvAG1eSFhiCl4hIyHMb5uO3s=; b=elfmwwcDJ9dDDawrAQo93Tcvwe1lPB8pS3PddOtAhuOetwvTw2AU/eAOLlzv/suIcK qutwpm1v0FMcRKuuAlb6usdG7nn7/KUmuIJe7ra3LsinKfD3HZ2x8ZcUkRgQwQi1BuIz BQNk0jeScJeHcSWg9Aoaq76YfxXGM5nrA3Ij9vJcwvyjYFSCmD104gGKxKkYPS1Hyl3N 9RSO4WwXbp0LJDnfe7GW95FL+/UPB3bYJrVkyHQSIDmxG2cwvy9Z9A1AK+3CGAJiw73D /AmtIYxZPPPaOZO9GVvDr1A5SHv+tL/WwtwQVwq+neLaWjP1eBFLjL+xiNFEWuyX6U6b zONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698272231; x=1698877031; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=unkegeJylmQqW6o0QisNvAG1eSFhiCl4hIyHMb5uO3s=; b=MAzBRsaPugfdN25KbK/bQyzmYFoV0CT48QO8JJh7rSXBMX6C7TUNCphWN3y7joTPx2 LEYm5aMriixvTPGmWRo1WY5e+1K/nRMPVMjt3isBgAFEcrEKwG10iYmwAWW3Txtpqv4Z 0LYGuZIvlluyODzYdsiPpagBogUfiIlyt+wwIo7FI4boFw/SnoKLAmebFtDlA3+Zodpo zNbhHb09yN8je5Mwfk/HiXA0+yfHKUpLBbE6qLdnfI4QC/J+lYOy8sB9A+n+GT/887xm rCKHET4YEjML2xlMQh8m4qqIEreBkmztaajPvmZX6OxvvMhnRdoLHEVTiaWlyj9DozCe mWDg== X-Gm-Message-State: AOJu0YyRTRpEXf0JKZ7F9h35wWN3O6lS+bk9Awy5O/qcb/M/3FpE28GH tqBZytXtC2Tgp0Ew31YfDHwxvkeKQoV9W9DuR84= X-Google-Smtp-Source: AGHT+IEORfE8fVWlrOPvJgr6x+JMGf6aJvz+2VDe4ARA9JqjwCaCXGQ8Z0PQ09537ef7W4rHYxGk1Jmv0aqwZxSjJXo= X-Received: by 2002:a4a:ca95:0:b0:57b:6ab1:87c9 with SMTP id x21-20020a4aca95000000b0057b6ab187c9mr17239153ooq.0.1698272231204; Wed, 25 Oct 2023 15:17:11 -0700 (PDT) MIME-Version: 1.0 References: <1901532185.8873313.1696511707263@mail.yahoo.com> <1653003450.12126241.1697462972371@mail.yahoo.com> In-Reply-To: From: "David G. Johnston" Date: Wed, 25 Oct 2023 15:16:54 -0700 Message-ID: Subject: Re: Reporting by family tree To: o1bigtenor Cc: Ibrahim Shaame , swastik Gurung , "pgsql-novice@lists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000012ab6c060891d1e0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000012ab6c060891d1e0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Oct 25, 2023 at 9:13=E2=80=AFAM o1bigtenor w= rote: > On Wed, Oct 25, 2023 at 9:55=E2=80=AFAM David G. Johnston > wrote: > > > > On Wed, Oct 25, 2023 at 5:21=E2=80=AFAM Ibrahim Shaame > wrote: > >> > >> But what I want to get is grandfather - father - children: > >> > >> 1 - Grandfather1 > >> > >> 3 - father1-1 > >> > >> 6 - son1-1 > >> > >> 7 =E2=80=93 son1-2 > >> > >> 4 - Father1-2 > >> > >> 8 - son2-1 > >> > >> 2 =E2=80=93 Grandfather2 > >> > >> 5 - Father2-1 > >> > >> etc > >> > >> > >> Any suggestion > >> > > > > If you want a different ordering of the output change the ORDER BY > specification. > > > > Specifically, you want to order by the path of each person. Since that > can only be determined during the traversal you need to create the path > data yourself. I suggest using an integer[] (integer array) to store the > path using ID values as breadcrumbs. > > > > > (Not the OP just someone following the list trying to learn.) > > 'using ID values as breadcrumbs' - - - can I interpret that to mean > the ordinal numbers 1-8 listed (more implied)? > > Yes, the numbers 1-8 are the values assigned to these 8 example individuals as their unique identifiers. {1} {1,3} {1,3,6} {1,3,7} {1,4} {1,4,8} {2} {2,5} David J. --00000000000012ab6c060891d1e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Oct 25, 2023 at 9:13=E2=80=AFAM o1bigtenor <o1bigtenor@gmail.com> wrote:
On Wed, Oct 25, 2023 at 9:55=E2=80=AFAM David G. John= ston
<david.g= .johnston@gmail.com> wrote:
>
> On Wed, Oct 25, 2023 at 5:21=E2=80=AFAM Ibrahim Shaame <ishaame@gmail.com> wrote= :
>>
>> But what I want to get is=C2=A0 grandfather - father - children: >>
>> 1 - Grandfather1
>>
>> 3 - father1-1
>>
>> 6 - son1-1
>>
>> 7 =E2=80=93 son1-2
>>
>> 4 - Father1-2
>>
>> 8 - son2-1
>>
>> 2 =E2=80=93 Grandfather2
>>
>> 5 - Father2-1
>>
>> etc
>>
>>
>> Any suggestion
>>
>
> If you want a different ordering of the output change the ORDER BY spe= cification.
>
> Specifically, you want to order by the path of each person.=C2=A0 Sinc= e that can only be determined during the traversal you need to create the p= ath data yourself.=C2=A0 I suggest using an integer[] (integer array) to st= ore the path using ID values as breadcrumbs.
>
>
(Not the OP just someone following the list trying to learn.)

'using ID values as breadcrumbs' - - - can I interpret that to mean=
the ordinal numbers 1-8 listed (more implied)?


Yes, the numbers 1-8 are the values assi= gned to these 8 example individuals as their unique identifiers.
{1}
{1,3}
{1,3,6}
{1,3,7}
{1,4}<= /div>
{1,4,8}
{2}
{2,5}

David J.
--00000000000012ab6c060891d1e0--