postgres, cannot see table data after migration - postgresql

After I've migrated a table from another database I cannot see the data in the postgres table. With \d I can see the schemas and tables but with a select using . I cannot see the data.
The table is in schema public, I try:
select * from public.ACCOUNTS;
select * from ACCOUNTS;
As I an new to postgres, excuse my simple questions, I'm sure I oversee the obvious.
BTW, having tried the 'first steps' guide on another page where a schema, user and table is created I did not have this problem.

I have faced this problem when using sequelize-cli Migrations, for some reason
you have to query the data from the Public Schema, Try this
select * from Public."Accounts"

Related

What is pg_class in Postgres and how to see it using pgAdmin 4?

I'm new to Postgresql and I just saw my friends query on a cakePhp controller that call 'pq_class'. I tried to look up to my PostgreSQL database and find out what's inside using pgAgmin4.
Unfortunately, I can't see any table name with 'pg_class'. I tried to google and find these pages :
https://www.postgresql.org/docs/current/catalog-pg-class.html
postgreSQL - pg_class question
But I am still confused about pg_class. Is there any good or real explanation about pg_class and how to see it using pgAdmin4 without using any query (just right click -> view data)
pg_class is an internal system table that stores information about tables (and similar objects") available in the database. Every database product has such a collection of system tables (and views) that it maintains.
You can (and in most cases should) use the views from the information_schema if you want to see information about tables, columns, views and other database objects.
You can get details from information_schema on pgadmin like this.
`
SELECT * FROM information_schema.columns;
select * from information_schema.tables`

create (or copy) table schema using postgres_fdw or dblink

I have many tables in different databases and want to bring them to a database.
It seems like I have to create foreign table in the database (where I want to merge them all) with schemas of all the tables.
I am sure, there is a way to automate this (by the way, I am going to use psql command) but I do not know where to start.
what I have found so far is I can use
select * from information_schema.columns
where table_schema = 'public' and table_name = 'mytable'
I added more detail explanation.
I wanted to copy tables from another database
the tables have same column names and data type
using postgres_fdw, I needed to set up a field name and data type for each tables (the table names are also same)
then, I want to union the tables have same name all to have one single table.
for that, I am going to add prefix on table
for instance, mytable in db1, mytable in db2, mytable in db3 as in
db1_mytable, db2_mytable, db3_mytable in my local database.
Thanks to Albe's comment, I managed it and now I need to figure out doing 4th step using psql command.

Tables are getting created in public schema rather than the other newly created schema in PostgreSQL using PgAdmin4

I am working on PostgreSQL and I want tables in a different schema, not in public.
I am using PgAdmin4. I created one schema and selected the same schema and open the Query Tool. I ran the following query to create the table:
DROP TABLE IF EXISTS ClassToTable;
CREATE TABLE ClassToTable (className varchar(4000), fieldName varchar(4000), tableName varchar(4000) );
But the table is getting created in public schema , rather than the schema which i have created and selected while executing the query.
Can you please help me in resolving this issue or any workaround??

Migrating data from public schema to table in another schema in postgreSQL

I need to migrate data from multiple tables in the db public schema to one table in a schema called fs. Then I need to match the migrated data, now is the fs schema, to data in a different table in the fs schema.
Would something like this work?
INSERT INTO targetTable
SELECT * FROM [sourceserver].[sourcedatabase].[dbo].[sourceTable]
Very new to postgreSQL and SQL in general, so please let me know if clarification is necessary. Thank you.
This will work
INSERT INTO Table2 (<columns>)
SELECT <columns>
FROM schema.Table1

SignalR hub not working with existing tables

In the begining I have given service broker enable status to database on MSSQL 2008. I have two tables with same fields. First one is existing table. Other is created new by me. Hub is not working with first existing table, but works fine with other table which we create new.
Our select statement is basic and we have used only select field like 'select field1,field2 from Table1 where field2=1'.
I am using C#.
What kind of problem can be in this issue, how can we solve?
I have found solution. SignalR wants table scheame name in sql statement. Default scheme name is dbo and our sql or stored procedure include dbo. Like:
'Select field1,field2 from dbo.Table1 where field2=1'.