Attach Database

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Oct 14, 2014 12:09 pm

Attach Database

Post by loulou2522 »

In sqlite you can attach à databse with this synthax

Code: Select all

ATTACH DATABASE 'toto'  As 'toto';
Can someone says me if it is possible in POSTGRESQL and eventually the sql synthax for
Thanks in advance
User avatar
spikey
Enthusiast
Enthusiast
Posts: 750
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Attach Database

Post by spikey »

Yes, you can make external data connections but there is no ATTACH DATABASE in PostgreSQL; this is because PostgreSQL is a security concious, extensible, networked service and SQLite is self contained and doesn't really secure anything inherently.

Are you literally trying to connect to an SQLite database from a PostgreSQL server? Or do you actually mean something else? If so, what precisely? This will govern the direction to head in...
percy_b
User
User
Posts: 72
Joined: Mon Jan 12, 2015 10:25 am

Re: Attach Database

Post by percy_b »

loulou2522 wrote:In sqlite you can attach à databse with this synthax

Code: Select all

ATTACH DATABASE 'toto'  As 'toto';
Can someone says me if it is possible in POSTGRESQL and eventually the sql synthax for
Thanks in advance
Hi Loulou2522,

PostgreSQL has a user-based system that revolves around schemas. Therefore, you can have a group of data that can exist under User1, User2, etc.

With this schema system you can then access these data-sources as User1.Table1, User1.Table2, User2.Table1,User2.Table2, User2.Table3,etc. All of these user/schemas exist in the same data file under PostgreSQL.

SQLite doesn't have this user/schema feature. Therefore, if you want to segregate data in SQLite, you have to use separate data files and employ the ATTACH statement.

However, it is possible to import external data into Postgres.

Sorry if I'm stating the obvious.

Sent from my LM-Q710.FG using Tapatalk
Post Reply