Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UBs90-0007uD-Kg for pgsql-sql@arkaria.postgresql.org; Sat, 02 Mar 2013 19:30:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UBs8z-0000wc-QR for pgsql-sql@arkaria.postgresql.org; Sat, 02 Mar 2013 19:30:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UBs8y-0000wW-V2 for pgsql-sql@postgresql.org; Sat, 02 Mar 2013 19:30:53 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UBs8v-00016V-UC for pgsql-sql@postgresql.org; Sat, 02 Mar 2013 19:30:52 +0000 Received: from mailout-de.gmx.net ([10.1.76.30]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MDBXW-1U20F21gNA-00GYgT for ; Sat, 02 Mar 2013 20:30:48 +0100 Received: (qmail invoked by alias); 02 Mar 2013 19:30:48 -0000 Received: from mue-88-130-56-218.dsl.tropolys.de (EHLO [192.168.1.113]) [88.130.56.218] by mail.gmx.net (mp030) with SMTP; 02 Mar 2013 20:30:48 +0100 X-Authenticated: #14269776 X-Provags-ID: V01U2FsdGVkX1+h8n0kZ4Chvui1WSPxnfw3j5vq4xj4U40mVgndSd foP2yrLXMIDEXx Message-ID: <5132536A.50508@gmx.net> Date: Sat, 02 Mar 2013 20:30:50 +0100 From: Andreas User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: I need to fill up a sparse table in an view Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hi, I need to fill up a sparse table in an view. The table holds some numbers relating months and objects. The month is an integer in the format YYYYMM. To make it more convenient to manage this table I decidet to let a value be good till the next entry. E.g. if there is an entry in january and march, the january entry is good in february, too. So the table looks like. my_numbers ( object_id int, month int, some_nr int ) ( 17, 201301, 123 ), ( 42, 201301, 456 ), ( 42, 201303, 789 ), Now I need a view that fills the gaps up till the current month. ( 17, 201301, 123 ), ( 17, 201302, 123 ), <-- filled gap ( 17, 201303, 123 ), <-- filled gap ( 42, 201301, 456 ), ( 42, 201302, 456 ), <-- filled gap ( 42, 201303, 789 ), Is this possible? -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql