I am using psycopg2.
I want to find the number of rows returned by the query which has offset and limit.
The total number of rows in mytable is 8
I want my result to be 4 as with limit and offset only 4 rows can be returned but I am getting 8. How can I modify the code to get the count of rows fetched with limit and offset i.e. 4.
data_fetch_sql = f"SELECT count(*) FROM mytable limit 4 offset 0"
self.cursor.execute(data_fetch_sql)
data = [x for x in self.cursor]
data[0][0]