From: Gustavsson Mikael <mikael.gustavsson@smhi.se>
To: Durumdara <durumdara@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: SV: Onfly, function generated ID for Select Query
Date: Fri, 10 Mar 2023 07:33:12 +0000
Message-ID: <7e3ca307301b4928a23c3c0a8cc2b576@smhi.se> (raw)
In-Reply-To: <CAEcMXhnbLPAAAPpZZ8WoPZKOW4U3PwmSg=ztFxBZZ2FHQeJn8w@mail.gmail.com>
References: <CAEcMXhnbLPAAAPpZZ8WoPZKOW4U3PwmSg=ztFxBZZ2FHQeJn8w@mail.gmail.com>
Hi,
Is it something like row_number() you want?
https://www.postgresql.org/docs/current/functions-window.html
KR
Mikael
________________________________
Från: Durumdara <durumdara@gmail.com>
Skickat: den 10 mars 2023 8:12
Till: Postgres General
Ämne: 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: mikael.gustavsson@smhi.se, durumdara@gmail.com
Subject: Re: Onfly, function generated ID for Select Query
In-Reply-To: <7e3ca307301b4928a23c3c0a8cc2b576@smhi.se>
References: <CAEcMXhnbLPAAAPpZZ8WoPZKOW4U3PwmSg=ztFxBZZ2FHQeJn8w@mail.gmail.com> <7e3ca307301b4928a23c3c0a8cc2b576@smhi.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox