From 69134e5a75760ea4d85914ab4e4a2e6fa9038566 Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Mon, 27 Jun 2022 16:22:51 -0230 Subject: [PATCH] Combine two column helper tables into one --- .../temp-docs/docs/guides/database/tables.mdx | 118 +++++++----------- web/docs/guides/database/tables.mdx | 93 +++++++------- 2 files changed, 91 insertions(+), 120 deletions(-) diff --git a/apps/temp-docs/docs/guides/database/tables.mdx b/apps/temp-docs/docs/guides/database/tables.mdx index 6340cf5091f..7f8e4caa582 100644 --- a/apps/temp-docs/docs/guides/database/tables.mdx +++ b/apps/temp-docs/docs/guides/database/tables.mdx @@ -77,83 +77,55 @@ create table todos ( ### Data types -Every column is a predefined type. PostgreSQL provides many [default types](https://www.postgresql.org/docs/current/datatype.html), and you can even design your own (or use extensions) if the default types don't fit your needs. - -Here's a list of the data types that are available to use in the table editor in the Dashboard: - -| `Name` | `Description` | `Example` | -| ------------------------------------------- | -------------------- | ----------------------------------------------------------------- | -| int2 | Can contain numbers between -32,768 and 32,767 | For storing numbers like ages of people, distance between places or numbers you know will be fairly small. | -| int4 | Can contain numbers between -2,147,483,648 and +2,147,483,648 | For storing numbers like the population of small towns or cities that you know will be less than about 2 billion. | -| int8 | Can contain numbers between 9,223,372,036,854,775,808 and +9,223,372,036,854,775,808 | For storing numbers larger than roughly 2 billion. Like the number of people who live in the Northern vs Southern hemisphere or the total number of COVID-19 vaccinations administered. | -| float4 | Can contain numbers with up to 6 decimal places | For storing things like temperature (22.5 degrees Celsius) or distance (10.25kms)| -| float8 | Can contain numbers with up to 15 decimal places | For storing numbers with a high level of precision, like scientific or mathematical data. | -| numeric | Can contain 131,072 digits before the decimal point and 16,383 digits after the decimal point. | For storing number that require very high precision. Use the numeric type when you need more precision than float4 or float8 offer. | -| json | Can contain JSON data. | For storing data that logically belongs together, like a person's street address. Useful for when you want to store dynamic fields and not have every field represented as a column in your table. | -| jsonb | The JSONB type stores your JSON input as a binary code instead of as an exact copy of the JSON data. JSONB is faster, more efficient and supports indexing. | If you are doing a lot of JSON manipulation in Postgres you should consider using JSONB for efficiency. Otherwise, if you are just doing typical data storing and fetching, JSON should be fine. | -| text | Can contain strings of any length. | For storing any kind of textual data. Examples include text contents of recipes or blog posts. This is the general purpose data type for textual content. | -| varchar | Can contain strings with a fixed length | For storing a string where you would want to limit the length to 160 characters. | -| uuid | Can store a universal unique identifier. | For storing unique IDs, like when you need to store a reference to another table row. | -| date | Can store a data value without time. | For storing dates like birthdays or holidays with a year, month and day. | -| time | Can store the time of day | For storing things like when a process starts and stops at specific times in the day. The lights come on at 6:00:00 a.m. and go off at 10:00:00 p.m. | -| timez | Can store the time of day, along with a timezone. | For storing things like event start times, like an Apple event starting at 10:00:00 a.m. Pacific Time. | -| timestamp | Can store the date and time without a timezone. | For storing times like: May 1st, 2022 at 10 a.m. | -| timestampz | Can store the date and time with a timezone. | For storing times like: May 1st, 2022 at 10 a.m, Pacific Time. | -| bool | Can store boolean values | For storing things that will be true or false, like user_is_subscribed or show_homepage_ad. | - - -Here's a complete list of all of the default data types provided by Postgres: +Every column is a predefined type. PostgreSQL provides many [default types](https://www.postgresql.org/docs/current/datatype.html), and you can even design your own (or use extensions) if the default types don't fit your needs. Here's a complete list of all of the default data types provided by Postgres:
Show/Hide default data types - -| `Name` | `Aliases` | `Description` | +| `Name` | `Aliases` | `Description` | | ------------------------------------------- | -------------------- | ----------------------------------------------------------------- | -| bigint | int8 | signed eight-byte integer | -| bigserial | serial8 | autoincrementing eight-byte integer | -| bit | | fixed-length bit string | -| bit varying | varbit | variable-length bit string | -| boolean | bool | logical Boolean (true/false) | -| box | | rectangular box on a plane | -| bytea | | binary data (“byte array”) | -| character | char | fixed-length character string | -| character varying | varchar | variable-length character string | -| cidr | | IPv4 or IPv6 network address | -| circle | | circle on a plane | -| date | | calendar date (year, month, day) | -| double precision | float8 | double precision floating-point number (8 bytes) | -| inet | | IPv4 or IPv6 host address | -| integer | int, int4 | signed four-byte integer | -| interval \[ fields \] | | time span | -| json | | textual JSON data | -| jsonb | | binary JSON data, decomposed | -| line | | infinite line on a plane | -| lseg | | line segment on a plane | -| macaddr | | MAC (Media Access Control) address | -| macaddr8 | | MAC (Media Access Control) address (EUI-64 format) | -| money | | currency amount | -| numeric | decimal | exact numeric of selectable precision | -| path | | geometric path on a plane | -| pg\_lsn | | PostgreSQL Log Sequence Number | -| pg\_snapshot | | user-level transaction ID snapshot | -| point | | geometric point on a plane | -| polygon | | closed geometric path on a plane | -| real | float4 | single precision floating-point number (4 bytes) | -| smallint | int2 | signed two-byte integer | -| smallserial | serial2 | autoincrementing two-byte integer | -| serial | serial4 | autoincrementing four-byte integer | -| text | | variable-length character string | -| time \[ without time zone \] | | time of day (no time zone) | -| time with time zone | timetz | time of day, including time zone | -| timestamp \[ without time zone \] | | date and time (no time zone) | -| timestamp with time zone | timestamptz | date and time, including time zone | -| tsquery | | text search query | -| tsvector | | text search document | -| txid\_snapshot | | user-level transaction ID snapshot (deprecated; see pg\_snapshot) | -| uuid | | universally unique identifier | -| xml | | XML data | - - +| bigint | int8 | Signed eight-byte integer. For numbers ranging from -9223372036854775808 to +9223372036854775807. | +| bigserial | serial8 | Autoincrementing eight-byte integer. For numbers ranging from 1 to 9223372036854775807. | +| bit | | Fixed-length bit string. | +| bit varying | varbit | Variable-length bit string. | +| boolean | bool | Logical Boolean (true/false). | +| box | | Rectangular box on a plane. | +| bytea | | Binary data (“byte array”). | +| character | char | Fixed-length character string. | +| character varying | varchar | Variable-length character string. | +| cidr | | IPv4 or IPv6 network address. | +| circle | | Circle on a plane. | +| date | | Calendar date (year, month, day). | +| double precision | float8 | Double precision floating-point number (8 bytes). 15 decimal digits of precision. | +| inet | | IPv4 or IPv6 host address. | +| integer | int, int4 | Signed four-byte integer. -2147483648 to +2147483647. | +| interval \[ fields \] | | Time span. | +| json | | Textual JSON data. | +| jsonb | | Binary JSON data, decomposed. If you are doing a lot of JSON manipulation in Postgres you should consider using JSONB for efficiency. Otherwise, if you are just doing typical data storing and fetching, JSON should be fine. | +| line | | Infinite line on a plane. | +| lseg | | Line segment on a plane. | +| macaddr | | MAC (Media Access Control) address. | +| macaddr8 | | MAC (Media Access Control) address (EUI-64 format). | +| money | | currency. | +| numeric | decimal | Exact numeric of selectable precision. Up to 131072 digits before the decimal point; up to 16383 digits after. For storing number that require very high precision. Use the numeric type when you need more precision than float4 or float8 offer. | +| path | | Geometric path on a plane. | +| pg\_lsn | | PostgreSQL Log Sequence Numb. | +| pg\_snapshot | | User-level transaction ID snapshot. | +| point | | Geometric point on a plane. | +| polygon | | Closed geometric path on a plane. | +| real | float4 | Single precision floating-point number (4 byte). 6 decimal digits precision. | +| smallint | int2 | Signed two-byte integer. For numbers ranging from -32768 to +32767 | +| smallserial | serial2 | Autoincrementing two-byte integer. For numbers ranging from 1 to 32767. | +| serial | serial4 | Autoincrementing four-byte integer. For numbers ranging from 1 to 2147483647 | +| text | | Variable-length character string. This is the general purpose data type for textual content. | +| time \[ without time zone \] | | Time of day (no time zone). | +| time with time zone | timetz | Time of day, including time zone. | +| timestamp \[ without time zone \] | | Date and time (no time zone). | +| timestamp with time zone | timestamptz | Date and time, including time zone. | +| tsquery | | Text search query. | +| tsvector | | Text search document . | +| txid\_snapshot | | User-level transaction ID snapshot (deprecated; see pg\_snapshot). | +| uuid | | Universally unique identifier. | +| xml | | XML data. |
diff --git a/web/docs/guides/database/tables.mdx b/web/docs/guides/database/tables.mdx index 54b3236deda..cd394dbefd7 100644 --- a/web/docs/guides/database/tables.mdx +++ b/web/docs/guides/database/tables.mdx @@ -111,57 +111,56 @@ Here's a list of the data types that are available to use in the table editor in Here's a complete list of all of the default data types provided by Postgres:
-View all default data types +Show/Hide default data types -| `Name` | `Aliases` | `Description` | +| `Name` | `Aliases` | `Description` | | ------------------------------------------- | -------------------- | ----------------------------------------------------------------- | -| bigint | int8 | signed eight-byte integer | -| bigserial | serial8 | autoincrementing eight-byte integer | -| bit | | fixed-length bit string | -| bit varying | varbit | variable-length bit string | -| boolean | bool | logical Boolean (true/false) | -| box | | rectangular box on a plane | -| bytea | | binary data (“byte array”) | -| character | char | fixed-length character string | -| character varying | varchar | variable-length character string | -| cidr | | IPv4 or IPv6 network address | -| circle | | circle on a plane | -| date | | calendar date (year, month, day) | -| double precision | float8 | double precision floating-point number (8 bytes) | -| inet | | IPv4 or IPv6 host address | -| integer | int, int4 | signed four-byte integer | -| interval \[ fields \] | | time span | -| json | | textual JSON data | -| jsonb | | binary JSON data, decomposed | -| line | | infinite line on a plane | -| lseg | | line segment on a plane | -| macaddr | | MAC (Media Access Control) address | -| macaddr8 | | MAC (Media Access Control) address (EUI-64 format) | -| money | | currency amount | -| numeric | decimal | exact numeric of selectable precision | -| path | | geometric path on a plane | -| pg\_lsn | | PostgreSQL Log Sequence Number | -| pg\_snapshot | | user-level transaction ID snapshot | -| point | | geometric point on a plane | -| polygon | | closed geometric path on a plane | -| real | float4 | single precision floating-point number (4 bytes) | -| smallint | int2 | signed two-byte integer | -| smallserial | serial2 | autoincrementing two-byte integer | -| serial | serial4 | autoincrementing four-byte integer | -| text | | variable-length character string | -| time \[ without time zone \] | | time of day (no time zone) | -| time with time zone | timetz | time of day, including time zone | -| timestamp \[ without time zone \] | | date and time (no time zone) | -| timestamp with time zone | timestamptz | date and time, including time zone | -| tsquery | | text search query | -| tsvector | | text search document | -| txid\_snapshot | | user-level transaction ID snapshot (deprecated; see pg\_snapshot) | -| uuid | | universally unique identifier | -| xml | | XML data | - - +| bigint | int8 | Signed eight-byte integer. For numbers ranging from -9223372036854775808 to +9223372036854775807. | +| bigserial | serial8 | Autoincrementing eight-byte integer. For numbers ranging from 1 to 9223372036854775807. | +| bit | | Fixed-length bit string. | +| bit varying | varbit | Variable-length bit string. | +| boolean | bool | Logical Boolean (true/false). | +| box | | Rectangular box on a plane. | +| bytea | | Binary data (“byte array”). | +| character | char | Fixed-length character string. | +| character varying | varchar | Variable-length character string. | +| cidr | | IPv4 or IPv6 network address. | +| circle | | Circle on a plane. | +| date | | Calendar date (year, month, day). | +| double precision | float8 | Double precision floating-point number (8 bytes). 15 decimal digits of precision. | +| inet | | IPv4 or IPv6 host address. | +| integer | int, int4 | Signed four-byte integer. -2147483648 to +2147483647. | +| interval \[ fields \] | | Time span. | +| json | | Textual JSON data. | +| jsonb | | Binary JSON data, decomposed. If you are doing a lot of JSON manipulation in Postgres you should consider using JSONB for efficiency. Otherwise, if you are just doing typical data storing and fetching, JSON should be fine. | +| line | | Infinite line on a plane. | +| lseg | | Line segment on a plane. | +| macaddr | | MAC (Media Access Control) address. | +| macaddr8 | | MAC (Media Access Control) address (EUI-64 format). | +| money | | currency. | +| numeric | decimal | Exact numeric of selectable precision. Up to 131072 digits before the decimal point; up to 16383 digits after. For storing number that require very high precision. Use the numeric type when you need more precision than float4 or float8 offer. | +| path | | Geometric path on a plane. | +| pg\_lsn | | PostgreSQL Log Sequence Numb. | +| pg\_snapshot | | User-level transaction ID snapshot. | +| point | | Geometric point on a plane. | +| polygon | | Closed geometric path on a plane. | +| real | float4 | Single precision floating-point number (4 byte). 6 decimal digits precision. | +| smallint | int2 | Signed two-byte integer. For numbers ranging from -32768 to +32767 | +| smallserial | serial2 | Autoincrementing two-byte integer. For numbers ranging from 1 to 32767. | +| serial | serial4 | Autoincrementing four-byte integer. For numbers ranging from 1 to 2147483647 | +| text | | Variable-length character string. This is the general purpose data type for textual content. | +| time \[ without time zone \] | | Time of day (no time zone). | +| time with time zone | timetz | Time of day, including time zone. | +| timestamp \[ without time zone \] | | Date and time (no time zone). | +| timestamp with time zone | timestamptz | Date and time, including time zone. | +| tsquery | | Text search query. | +| tsvector | | Text search document . | +| txid\_snapshot | | User-level transaction ID snapshot (deprecated; see pg\_snapshot). | +| uuid | | Universally unique identifier. | +| xml | | XML data. |
+
You can "cast" columns from one type to another, however there can be some incompatibilities between types.