Show definition of custom database datatype - postgresql

I'm currently working with an existing database, which has a custom datatype called geometry (using the postgis extension). When I extract data from that column in the database all it gives me is a string with 50 chars, but I don't know how the string is created and therefore how I can figure out what the actual data is.
Is there a way to look at custom datatype definitions in postgres?
I tried psql \dT and psql \dT+ but didn't see the definition.
Unfortunately I don't have pgadmin.
Thanks!

Related

Ora2PG REPLACE_AS_BOOLEAN property and exclude one column by replacing

I'm using ora2pg to import an oracle db schema into a postgresql db schema. I configured all in the correct way and I'm able to dump the oracle dn into the postgresql db.
In the schema that I'm converting I have some columns number(1,0) that I need to convert as boolean in the pg schema.
At first I used this configuration
REPLACE_AS_BOOLEAN NUMBER:1
so every column with this type will be conmverted as boolean in the pg db.
The problem is that I have a column in the oracle schema defined as number(1,0). This column has to remain numeric and maintain the same type on the pg schema, so it hasn't to be converted as boolean.
This means that i changed the property in this manner
REPLACE_AS_BOOLEAN TABLE1:COLUMN1 TABLE2:COLUMN2 TABLE3:COLUMN3
I have a lot of columns that they have to be converted as boolean and the definition of this property became very long.
Is there a method to define the REPLACE_AS_BOOLEAN property to replace all the column with type number(1,0), but with some exception for one or some of them?
I had to wrote the property with the list of all the tables name and columns name

SAS SQL Pass-Through Facility does not work as expected for Postgres database

I am working with SCD Type 2 transformation in SAS Data integration Studio (4.905) and using Postgres (12) as database.
I am facing the following error when I try to execute a query via passthrough:
When using passthrough in Postgres, SCD Type 2 doesn't enclose the table name in quotes (which would keep the name uppercase, since postgres converts all unquoted data to lowercase) and so doesn't find it as you can see.
My questions are:
Is there a way to make SCD2 transformation declare the table’s name, used via passthrough, in quotes?
Is there a way to make the SCD2 transformation create intermediate tables ‘name in lower case so that the reference is not lost when doing passthrough?
Is there a global option in DI that allow us to modify/edit temporary table names?
Source and target tables are postgresql tables, with name and columns name in lowercase:
Please, if anyone has faced this problem before or knows what is missing, please, let I know.
To solve this issue, we have to select the following highlighted (source and target) table options. It results in quotes around source/target table names:
Then, SCD2 transformation automatically put quotes in tables y columns names as you can see:

Change Heroku Postgres database column type while retaining data

I've created a Heroku Postgres database, with one of the columns being db.Integer - storing integers. However, I realize that I should actually store floating point numbers instead - i.e., db.Float.
Can I change the type of a PostgreSQL database column - after it has been created with data?
Yes, you can. Use following query to do that:
ALTER TABLE $TABLE_NAME ALTER COLUMN $COLUMN_NAME TYPE <float type, e.g. float(64)>;

what datatype to choose when using blobs in postgresql

I understand that Postgresql has a bytea datatype and I have used it before. But I want to use the "blob" datatype so the data does not get loaded into memory first. However I don't see a blog data type in Pgadmin. Do I use the "oid" data type instead?

pg dump output the schema name and the data

when i use (pg_dump -f backup.sql mydb), the schema name are not included. How to dump that will output also the scheme name(personal). see example below
Output : ALTER TYPE basicinfo OWNER TO postgres;
// note : basicinfo is the name of the table
Expected Output : ALTER TYPE personal.basicinfo OWNER TO postgres;
any ideas?
Global Database properties such as OWNER etc. are always given with SCHEMA names in a pg_dump output.
However, for non-global database objects, as far as I know, there isn't any way to get SCHEMA names prepended to all the database objects. The way the script works is that it sets the SET search_path before-hand all Schema specific database objects... which is more efficient and has the same effect.
In case you are trying to parse an pg_dump output to extract a given SQL line that works independently, you may have to also parse the nearest-preceding SET search_path line and execute that before executing the target line (for e.g. ALTER TYPE) to have the desired effect.
You cant do that using pg_dump directly.
Try to use different tools, They have different implementation for exporting PostgreSQL database.
Here are list of tools:
phpPgAdmin - http://sourceforge.net/projects/phppgadmin
AnySQL Maestro - http://www.sqlmaestro.com/products/anysql/maestro/
DBeaver - http://dbeaver.jkiss.org/
All refence: https://wiki.postgresql.org/wiki/Community_Guide_to_PostgreSQL_GUI_Tools