Solved

PostgreSQL Writer to inherited table


Greetings,

Is writer to PostgreSQL inherited table is supported by FME desktop. It's not working and return error.

Regards,

Maha

icon

Best answer by markatsafe 4 June 2021, 19:03

View original

6 replies

Userlevel 5
Badge +29

What is the error being reported?

What is the error being reported?

Below is the error while trying to add writer to inherited table:

SOURCE_READER statement must be of the form 'SOURCE_READER <reader type> [<parm> <value>]*' -- `SOURCE_READER POSTGRES SCHEMAS_FOR_TABLE_LISTING us_govserv_ext EXPOSED_ATTRS' is invalid : Row came from between lines 1 and 19 of file C:\\Program Files\\FME\\metafile\\POSTGRES.fmf

Failed to read schema features from dataset 'serag_conn' using the 'POSTGRES' reader

Badge +2

@maha​ FME should be able to read a PostgreSQL table that uses INHERITS. I created a very simple example and it seems OK:

CREATE TABLE cities (
    name            text,
    population      float,
    elevation       int     -- in feet
);
CREATE TABLE capitals (
  state      char(2) UNIQUE NOT NULL
) INHERITS (cities);
 
INSERT INTO cities VALUES ('surrey', 8000.0,10);
INSERT INTO cities VALUES ('vancouver', 8000.0,10);
 
INSERT INTO capitals VALUES ('victoria', 8000.0,10,'BC');
 

So I suspect the issue is arising elsewhere and not related to the  INHERITS

@maha​ FME should be able to read a PostgreSQL table that uses INHERITS. I created a very simple example and it seems OK:

CREATE TABLE cities (
    name            text,
    population      float,
    elevation       int     -- in feet
);
CREATE TABLE capitals (
  state      char(2) UNIQUE NOT NULL
) INHERITS (cities);
 
INSERT INTO cities VALUES ('surrey', 8000.0,10);
INSERT INTO cities VALUES ('vancouver', 8000.0,10);
 
INSERT INTO capitals VALUES ('victoria', 8000.0,10,'BC');
 

So I suspect the issue is arising elsewhere and not related to the  INHERITS

Hi Mark,

Thanks for your response.

 

The issue exist at adding new writer to the inherited table.

Inherited table is working correctly with me at querying at database level and at SQLExecuter.

The problem is with writer. while trying to define new writer >> the error generated and writer not added.

You can make a test by adding new writer to the 'capitals' table that you shared it's script >> the error will generated.

 

Regards,

Maha

 

Badge +2

Hi Mark,

Thanks for your response.

 

The issue exist at adding new writer to the inherited table.

Inherited table is working correctly with me at querying at database level and at SQLExecuter.

The problem is with writer. while trying to define new writer >> the error generated and writer not added.

You can make a test by adding new writer to the 'capitals' table that you shared it's script >> the error will generated.

 

Regards,

Maha

 

@maha​ sorry - I don't see that error. I'm working with FME 2021.0. What version of FME are you using?

The steps I use are:

  • add Postgresql writer
  • Table Definition: Import from Dataset

It seems to add the 'capitals' table that has the INHERITS ok.

Hi Mark,

Thanks for your response.

 

The issue exist at adding new writer to the inherited table.

Inherited table is working correctly with me at querying at database level and at SQLExecuter.

The problem is with writer. while trying to define new writer >> the error generated and writer not added.

You can make a test by adding new writer to the 'capitals' table that you shared it's script >> the error will generated.

 

Regards,

Maha

 

Hi Mark,

Thanks so much. I think the problem was version. it's working correctly now

Regards,

Maha

Reply