X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3F81BD1C4EB for ; Tue, 9 Mar 2004 15:09:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 54062-02 for ; Tue, 9 Mar 2004 11:09:19 -0400 (AST) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id B60C4D1BA6C for ; Tue, 9 Mar 2004 11:09:13 -0400 (AST) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id i29F9lNu000314; Tue, 9 Mar 2004 17:09:47 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id i29F9lcb000310; Tue, 9 Mar 2004 17:09:47 +0200 Date: Tue, 9 Mar 2004 17:09:47 +0200 (EET) From: Achilleus Mantzios To: ow Cc: pgsql-sql@postgresql.org Subject: Re: currval() without specifying the sequence name In-Reply-To: <20040309145359.79236.qmail@web60805.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/84 X-Sequence-Number: 17183 O kyrios ow egrapse stis Mar 9, 2004 : > > --- Achilleus Mantzios wrote: > > > > You could use the same sequence in many tables. > > > > I guess I could but then: > > 1) I'd still have to know the sequence name. When integrating pgSql with 3party > frameworks I'd either have to pass it there (could be a very difficult task) or > make some assumptions (also not very good). > > 2) There may be a need to have different sequences being used in an app. > > 3) If one sequence is used, in many cases it'll have to be of type int8 and > pgSql does not handle searches with int8 very nicely. > > Thanks > > I dont think you have given solid reasons as to why somebody whould want to do that (in order to be more specific and help you better), but in any case: foodb=# SELECT relname from pg_class where relkind = 'S'; relname --------------- footbl_id_seq footbl2_id_seq (1 row) gives you a list of sequences of your current schema. Then you can loop thru those to: select last_value from ; and get the maximum, but again what exaclty are you trying to do? > > > __________________________________ > Do you Yahoo!? > Yahoo! Search - Find what you’re looking for faster > http://search.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- -Achilleus