Same in Spain. There's an access code printed on the receipts. At least in the ones in tourist areas. Though you can wait till someone comes out or ask another customer.
In some areas of Spain, restaurants and bars that occupy the public space with terraces are obliged by law to provide bathrooms to anyone asking if I recall correctly