I found several posts explaining how to import a .gdb file into PostGIS.
Is exporting also possible?
For example using
ogr2ogr to generate a .gdb file from query result.
Yes its possible using the ogr2ogr package with gdal.
sudo apt-get -y install gdal-bin
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 dbname=osm user=postgres password=123" something.gdb -overwrite -progress --config PG_USE_COPY YES