String line count in Postgres

ChatGPT taught me how to count lines of a string cpolumn in Postgres:

SELECT id, COUNT(*) AS line_count
FROM (
  SELECT id, regexp_split_to_table(your_column, E'\\r?\\n') AS lines
  FROM your_table
) AS subquery
GROUP BY id;