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 1tWGZH-00FOAS-U1 for pgsql-general@arkaria.postgresql.org; Fri, 10 Jan 2025 15:05:00 +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 1tWGZG-00HPjI-MK for pgsql-general@arkaria.postgresql.org; Fri, 10 Jan 2025 15:04:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tWGZG-00HPj9-5s for pgsql-general@lists.postgresql.org; Fri, 10 Jan 2025 15:04:58 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tWGZC-000tXx-0g for pgsql-general@lists.postgresql.org; Fri, 10 Jan 2025 15:04:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1736521491; bh=NmlglLT4FlFTq0cG2pc6JXZUEGyfmPs6lhIt/kkId1Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=VI8CUty28bj1taiRHvZ7Is68KdYgYLnylmPgMFX2UTn8AOaEpQ9KONS1IAOxO+t1+ WFuhWgeS4EILsnQJcjTmypAgra+QIxh4WuDeFxYfltaGHkrqC/0rlk2gUuqYteS+uK RLJFJ8lKDjocQqyepoBY2se6WVVzRuhuxh1fxAzCJp/9KR9V6b97eOoJ3b8WgZbTnq TSuMXpA51AwRBLGiJ+PB2H9XtHSPpw/qBG5Ckm9eYHzkPqdCM3IXKKkBzqhYMloxpn UZO1zjOpwiHgf80h0t/lk7IJJluS9eEqI3OMflH43IMk0CR2/FcS6RGT1+jGKKrj8f 7LRy5LE0oh/mg== Received: from mail.postgrespro.ru (webmail-slave-mstn.l.postgrespro.ru [192.168.2.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: v.popolitov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 129BB606DF; Fri, 10 Jan 2025 18:04:51 +0300 (MSK) MIME-Version: 1.0 Date: Fri, 10 Jan 2025 22:04:51 +0700 From: Vladlen Popolitov To: Dominique Devienne Cc: Igor Korot , Christophe Pettus , "David G. Johnston" , Ron Johnson , "pgsql-generallists.postgresql.org" Subject: Re: Postgres do not support tinyint? In-Reply-To: References: <11AA76D0-CAFE-4A17-BCCF-50520CCDF47F@thebuild.com> <051EB6AC-2395-4EAD-B30C-069FBC01107F@thebuild.com> <59d067bdcf17bd5a624eb7c736779853@postgrespro.ru> Message-ID: <81bde2a02f6fee0bab8253a3118e19ad@postgrespro.ru> X-Sender: v.popolitov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected, bases: 2025/01/10 13:01:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/01/10 08:29:00 #26967733 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne писал(а) 2025-01-10 16:41: > On Fri, Jan 10, 2025 at 10:13 AM Vladlen Popolitov > wrote: >> If you really need 1-byte integer, you can use "char" type. Cast it >> to/from int. See comment at the end of the page >> https://www.postgresql.org/docs/17/datatype-character.html > > Hi. What would be the best online doc to learn about the physical > storage / format for rows/pages/btree, etc... To understand alignment, > packing, varint or not, all those things. I'm quite familiar with the > [SQLite format][1], having read that doc dozens of times, and I'd like > a better low-level understanding for PostgreSQL as well. TIA, --DD > > [1]: https://www.sqlite.org/fileformat.html I would recommend "PostgreSQL Internals" of Egor Rogov (Chapter 3 about tuples, other chapters also great) Free download from https://postgrespro.com/community/books/internals Also PostgreSQL source code is officially the part of the documentation. It is not joke. PostgreSQL source has clear comments in functions code and in structure declarations. You can compare with other sources, it is hard to find better comments made with love. Heap tuple information is in source file src/include/access/htup_details.h (HeapTupleHeaderData structure), but I recommend to read above book first, it simplier explains many internal concepts. -- Best regards, Vladlen Popolitov.