Restore deleted table

If you run tt-rss on an officially unsupported platform (shared hosting, Windows, etc.) post here
dariottolo
Bear Rating Trainee
Bear Rating Trainee
Posts: 27
Joined: 05 Jul 2014, 18:57

Restore deleted table

Postby dariottolo » 21 Feb 2015, 17:37

Dear all,

first of all, I made a stupid mistake and I am fully aware of that.

I deleted ttrss_plugin_storage table from the database.
Of course I had no backup...

Anyone could provide me the sql query to restore it?

I tried the instructions ttrss_schema_pgsql.sql:

Code: Select all

create table ttrss_plugin_storage (
   id serial not null primary key,
   name varchar(100) not null,
   owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
   content text not null);


but phpPGAdmin does not like them:

Code: Select all

Errore SQL:

ERROR:  syntax error at or near "create"
LINE 1: SELECT COUNT(*) AS total FROM (create table ttrss_plugin_sto...
                                       ^
Nel costrutto:

SELECT COUNT(*) AS total FROM (create table ttrss_plugin_storage (
   id serial not null primary key,
   name varchar(100) not null,
   owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
   content text not null)) AS sub


Any help would be really appreciated.

Regards

Dario

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: Restore deleted table

Postby AngryChris » 21 Feb 2015, 20:04

dariottolo wrote:Dear all,

first of all, I made a stupid mistake and I am fully aware of that.

I deleted ttrss_plugin_storage table from the database.
Of course I had no backup...

Anyone could provide me the sql query to restore it?

I tried the instructions ttrss_schema_pgsql.sql:

Code: Select all

create table ttrss_plugin_storage (
   id serial not null primary key,
   name varchar(100) not null,
   owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
   content text not null);


but phpPGAdmin does not like them:

Code: Select all

Errore SQL:

ERROR:  syntax error at or near "create"
LINE 1: SELECT COUNT(*) AS total FROM (create table ttrss_plugin_sto...
                                       ^
Nel costrutto:

SELECT COUNT(*) AS total FROM (create table ttrss_plugin_storage (
   id serial not null primary key,
   name varchar(100) not null,
   owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
   content text not null)) AS sub


Any help would be really appreciated.

Regards

Dario

I think you're entering the query in the wrong place in phpPGAdmin. There's nothing wrong with the query you entered but the error you've posted shows that phpMyAdmin has wrapped it in a SELECT statement. I'm not familiar with phpPHAdmin (I use the SQL command line itself). But you can see this issue if you look at your error this way:

Code: Select all

Errore SQL:

ERROR:  syntax error at or near "create"
LINE 1: SELECT COUNT(*) AS total FROM (create table ttrss_plugin_sto...
                                       ^
Nel costrutto:

SELECT COUNT(*) AS total FROM ( >>> This is the query from the schema file here.  Anything not between these parenthesis is wrong. <<< ) AS sub

dariottolo
Bear Rating Trainee
Bear Rating Trainee
Posts: 27
Joined: 05 Jul 2014, 18:57

Re: Restore deleted table

Postby dariottolo » 21 Feb 2015, 21:13

I managed to recreate the table, ma now I get (a lot of) the following two errors:

Code: Select all

Query SELECT name, content FROM ttrss_plugin_storage
            WHERE owner_uid = '2' failed: ERROR:  permission denied for relation ttrss_plugin_storage


and

Code: Select all

pg_fetch_assoc() expects parameter 1 to be resource, boolean given


both with filename being "classes/db/pgsql.php"

Any one could somehow let me know how to properly edit the table?

Thank you again for your time.

Regards

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Restore deleted table

Postby fox » 21 Feb 2015, 21:39

this really isn't a "teach me postgresql basics forum" consider posting somewhere else

dariottolo
Bear Rating Trainee
Bear Rating Trainee
Posts: 27
Joined: 05 Jul 2014, 18:57

Re: Restore deleted table

Postby dariottolo » 21 Feb 2015, 21:58

Yes, sorry. Please close the thread or remove it, as you prefere


Return to “Unsupported platforms”

Who is online

Users browsing this forum: No registered users and 2 guests