On my PostgreSQL DB I have a table that looks like below. The description column can store a string of any size.
What I'm looking for, is a way to select just the first X chars from the content of the description column, or the whole string if X > description.length
CREATE TABLE descriptions (
id uuid NOT NULL,
description text NULL,
);
E.g.: If X = 100 chars and if in the description column I store a string containing 150+ chars, when I run select <some method on description> from descriptions
, I just want to get back the first 100 chars from the description column.
Bonus if the approach proposed is extremely fast!