Helper functions to deal with data fetching

There are other helper functions that help you retrieve the results. Let's go through these functions one by one:


Using the pg_free_results function, we can clear the memory resources that are used to hold the result set. All the data retrieval functions we used earlier occupy a certain amount of memory to hold the result set. It is a good practice to clear the result set after we are done processing the query results.


Using the pg_num_rows function, we can get the number of tuples in the result set. That is, if we execute a query, it returns the number of tuples the SELECT query has fetched from the database.


Using the pg_num_fields function, we can get the number ...

Get PostgreSQL Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.