Re: [BUGS] Where clause in pg_dump: need help

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: [BUGS] Where clause in pg_dump: need help
Дата
Msg-id CA+bJJbxLuaasq8Birr6OtfzR_ZEH4bLSRoq7ooAVYpGV_7ypcQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] Where clause in pg_dump: need help  (Prashanth Adiyodi <Prashantha@celltick.com>)
Список pgsql-general
Hi Adi: ( Is this correct? Adi is what your message uses to mark your replies ).

On Sun, Jul 10, 2016 at 6:53 PM, Prashanth Adiyodi
<Prashantha@celltick.com> wrote:
> Hi Franciso, My comments below inline

Got them. Only problem is your MUA does not signal quotes. It looks
like some kind of outlook by the headers it sends, so I assume it is
normal, I will try to correct it.

>> 1.- You have a backup with a series of tables which get inserted WITH a timestamp.
> Adi-The series of tables may or may not have timestamp
>> 2.- At the end of the day you want to transfer the inserted data, and only the inserted data, to another server and
insertit ther. 
> Adi-Exactly., somewhere post midnight I need to transfer the inserted data for the day to another DB.

Then you NEED some kind of marker. The tables WITHOUT timestamp (
point 1 above ) are going to be difficult.

For the discussion I assume you are somehow capable of making a SELECT
query which identifies inserted data for the day, and that either you
do not care about updates/deletions ( not having any is a subset of
this condition ) or you can do a query for those too.

> Adi- I am OK with the copy command, however I am not able to understand (my bad, I am not used to postgres and using
forthe 1st time) the where clause that should be used to achieve this result. 

Well, then your problem is on the queries. You need to be able to
identify the data inserted yesterday. There is no magic way to do it.
You NEED some kind of timestamp column. If you lack this you can use a
trigger to mark them into auxiliary tables or, if you feel
adventurous, you can try to use the xmin/xmax columns ( I would NOT
recommend even trying that, given you are having problems with simple
select queries ).

> I tries using something like the below,
> psql -d my_db -c 'copy (select * from mytab WHERE date_trunc('day',NOW() - interval '1 day') TO STDOUT' -o
data1.copy;

Your where expresion is a constant of timestamp type, i.e.,
'2016-07-11 12:00:00+00', where needs a BOOLEAN.

YOU need to be able to identify the inserted rows. YOU know your data
definitions. Ar you able to query them ?

> but this, I am sure has some syntax errors, could you help correct this,

NOT, because I do not know the table structure. Only you can do that.

Francisco Olarte.


В списке pgsql-general по дате отправления:

Предыдущее
От: AMatveev@bitec.ru
Дата:
Сообщение: Re: Memory usage per session
Следующее
От: hamann.w@t-online.de
Дата:
Сообщение: Re: Running query without trigger?