Using ST_SquareGrid to create grids
If you want a 1 degree grid, make your reference system by geographic (eg 4326) and then make a 1 unit grid, with your shape providing the bounds.
with grid as (
select (st_squaregrid(1, st_transform(geom,4326))).*
from admin0 where name = 'Canada'
)
select st_astext(geom), i, j from grid;
I believe the example here should help you.
Basically if you want to create a grid based on the bounds of a country just use the country's polygon, transformed into the CRS you want the grid to be in, and use the size you want the cells to be in.
SELECT (ST_SquareGrid(400000, ST_Transform(a.geom, 3857))).*
FROM admin a
WHERE name = 'Brazil';
If you want the grid cells to go a size smaller, you could select one cell from the large grid and call ST_SquareGrid
on it.