Loading topic
SELECT, WHERE, INSERT, CREATE TABLE) and know the common PostgreSQL types: integer, numeric, text, boolean, date, and timestamp. You also need psql or another PostgreSQL client. By the end you will know the three explicit conversion4 min readCAST, :: and typed literals. It covers how PostgreSQL assigns a type to a value you write directly in a query. That decision affects which 5 min readpsql. It builds on the cast syntaxes from the previous chapters (CAST, :: and typed literals). It covers what happens to a number when it moves between smallint, integer, bigint, `num4 min readCAST and :: syntax and the difference between explicit, assignment and implicit casts, which earlier chapters cover. It focuses on the three character types and on how PostgreSQL moves values into and out of them.3 min readpsql or another client open. It explains the three contexts that decide whether PostgreSQL converts a value for you or makes you ask for the conversion.5 min readCAST, ::) and the basic types numeric, text, date and timestamptz. You also need a psql session.4 min readCAST, :: and typed literals) and the difference between implicit, assignment and explicit casts from earlier chapters. You should also be comfortable with date, timestamp and timestamptz, and be able to run the examples in psql.5 min readCAST, ::, typed literals) and the difference between explicit and assignment casts. It covers what happens when a conversion fails, how to find the bad values, and how to convert the rest without aborting the whole statement.5 min readpg_cast, and learn which conversions it does not list.4 min read'2' has type unknown until PostgreSQL resolves it. You should also be comfortable with pg_typeof().4 min read-> and ->> operators, the difference between json and jsonb, and the cast syntaxes from earlier chapters. It covers how SQL values become JSONB, how JSONB values come back out, and where the conversions fail.5 min readCAST, ::, typed literals) and the difference between implicit, assignment and explicit casts from earlier chapters. It also assumes you know that a cast from text to another type calls that type's input function. Here you apply those ideas to arra4 min readEXPLAIN output and know what a B-tree index is. It also assumes you are comfortable with CAST, :: and the implicit, assignment and explicit cast contexts from earlier chapters. The goal is to find casts that stop PostgreSQL from using an index, and to fix them5 min readCAST, ::, typed literals), the implicit, assignment and explicit cast contexts, and how unknown-type literals resolve. It also assumes you can read pg_cast. Enums and domains are user-defined types, so they have fewer built-in conversions than t4 min readpg_cast lists the built-in casts. It also assumes you can write a simple SQL function. The examples run in psql on any recent PostgreSQL version.4 min read