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 1paXFf-0000yq-1w for pgsql-general@arkaria.postgresql.org; Fri, 10 Mar 2023 07:33:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1paXFd-0003x6-LH for pgsql-general@arkaria.postgresql.org; Fri, 10 Mar 2023 07:33:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paXFd-0003uP-6Z for pgsql-general@lists.postgresql.org; Fri, 10 Mar 2023 07:33:17 +0000 Received: from smtpout.smhi.se ([91.192.30.29] helo=smtpout2.smhi.se) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paXFZ-0004vW-HC for pgsql-general@postgresql.org; Fri, 10 Mar 2023 07:33:16 +0000 Received: from winserv811.ad.smhi.se (winserv811.ad.smhi.se [172.16.6.37]) by smtpout2.smhi.se (Postfix) with ESMTPSA id 4C4C510A7EDA; Fri, 10 Mar 2023 07:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smhi.se; s=20180112; t=1678433592; bh=s1ZhtDxEmBeCUeJis8PV+3Tq8JcCDnlDKpLGwjB5YMM=; h=From:To:Subject:Date:References:In-Reply-To:From; b=fp8pmON31IkBROKAOwWH1HgwmSsH/hNcj1QCeKymO4fpQDopjgU1+qMhMNGBbAZ1r IBK8shBNvhkg+hrFO+b67JkDqdG0YPmYIMN3Gnbophl27CEUvc9j9jYpJO+6RxvctJ /qpgx4ObXz8C8BCpgUQwqlCZ2xIFZDpCt8nArLGo= Received: from winserv811.ad.smhi.se (172.16.6.37) by winserv811.ad.smhi.se (172.16.6.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 10 Mar 2023 08:33:12 +0100 Received: from winserv811.ad.smhi.se ([fe80::fe14:1050:c4af:853c]) by winserv811.ad.smhi.se ([fe80::fe14:1050:c4af:853c%5]) with mapi id 15.02.1118.025; Fri, 10 Mar 2023 08:33:12 +0100 From: Gustavsson Mikael To: Durumdara , Postgres General Subject: SV: Onfly, function generated ID for Select Query Thread-Topic: Onfly, function generated ID for Select Query Thread-Index: AQHZUx+yd9xe6qEDl065e18wor/e867znpn2 Date: Fri, 10 Mar 2023 07:33:12 +0000 Message-ID: <7e3ca307301b4928a23c3c0a8cc2b576@smhi.se> References: In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: sv-SE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.66.1.221] Content-Type: multipart/alternative; boundary="_000_7e3ca307301b4928a23c3c0a8cc2b576smhise_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_7e3ca307301b4928a23c3c0a8cc2b576smhise_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, Is it something like row_number() you want? https://www.postgresql.org/docs/current/functions-window.html KR Mikael ________________________________ Fr=E5n: Durumdara Skickat: den 10 mars 2023 8:12 Till: Postgres General =C4mne: Onfly, function generated ID for Select Query Dear Members! I'm searching for a simple solution, like this: select GetIDForThisSelect(1, 1) as UID, * from anytablehasdoublestringkey join othertablehasnotuniqueintegerkey ... where .... Ok, I can make a sequence, but I don't want to use persistent data. It is enough to get 1...N as UID for this select. Like generate_series, but that is generating rows. Maybe you have some trick to do this. Thank you for any assistance! Best regards dd --_000_7e3ca307301b4928a23c3c0a8cc2b576smhise_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi,


Is it something like row_number() you want?

https://www.postgresql.org/docs/current/functions-wind= ow.html

KR
Mikael

Fr=E5n: Durumdara <durum= dara@gmail.com>
Skickat: den 10 mars 2023 8:12
Till: Postgres General
=C4mne: Onfly, function generated ID for Select Query
 
Dear Members!

I'm searching for a simple solution, like this:

select GetIDForThisSelect(1, 1) as UID, * from anytablehasdoublestring= key
join othertablehasnotuniqueintegerkey ...
where ....

Ok, I can make a sequence, but I don't want to use persistent data.
It is enough to get 1...N as UID for this select.

Like generate_series, but that is generating rows.

Maybe you have some trick to do this.

Thank you for any assistance!

Best regards
dd
--_000_7e3ca307301b4928a23c3c0a8cc2b576smhise_--