Re: Safe operations?

2018-08-12 Thread Tom Lane
Tim Cross writes: > On Mon, 13 Aug 2018 at 12:23, Olivier Gautherot >> On Sun, Aug 12, 2018 at 11:06 PM, Tim Cross wrote: >>> Just wondering - what about the case when the column being renamed is >>> also referenced in an index or check constraint? >> Tim, as far as I know, names are only an at

Re: Safe operations?

2018-08-12 Thread Tim Cross
On Mon, 13 Aug 2018 at 12:23, Olivier Gautherot wrote: > On Sun, Aug 12, 2018 at 11:06 PM, Tim Cross wrote: > >> >> On Mon, 13 Aug 2018 at 11:24, Adrian Klaver >> wrote: >> >>> On 08/12/2018 05:41 PM, Samuel Williams wrote: >>> > I wish the documentation would include performance details, i.e.

Re: Safe operations?

2018-08-12 Thread Olivier Gautherot
On Sun, Aug 12, 2018 at 11:06 PM, Tim Cross wrote: > > On Mon, 13 Aug 2018 at 11:24, Adrian Klaver > wrote: > >> On 08/12/2018 05:41 PM, Samuel Williams wrote: >> > I wish the documentation would include performance details, i.e. this >> > operation is O(N) or O(1) relative to the number of rows

Re: Safe operations?

2018-08-12 Thread Tim Cross
On Mon, 13 Aug 2018 at 11:24, Adrian Klaver wrote: > On 08/12/2018 05:41 PM, Samuel Williams wrote: > > I wish the documentation would include performance details, i.e. this > > operation is O(N) or O(1) relative to the number of rows. > > > > I found renaming a table was okay. > > > > How about

Re: Safe operations?

2018-08-12 Thread Adrian Klaver
On 08/12/2018 05:41 PM, Samuel Williams wrote: I wish the documentation would include performance details, i.e. this operation is O(N) or O(1) relative to the number of rows. I found renaming a table was okay. How about renaming a column? Is it O(1) or proportional to the amount of data? Is

Safe operations?

2018-08-12 Thread Samuel Williams
I wish the documentation would include performance details, i.e. this operation is O(N) or O(1) relative to the number of rows. I found renaming a table was okay. How about renaming a column? Is it O(1) or proportional to the amount of data? Is there any documentation about this? Thanks Samuel

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Adrian Klaver
On 08/12/2018 03:54 PM, Stephen Frost wrote: Greetings, * Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: OK. I think this is perhaps a documentation bug, maybe a missing warning when the master reads its configuration, and maybe (as you say) a bad default value. If we consider it

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Adrian Klaver
On 08/12/2018 02:56 PM, Phil Endecott wrote: Stephen Frost wrote: Specifically, section 26.2.5 of the docs says: "If you use streaming replication without file-based continuous archiving, the server might recycle old WAL segments before the standby has received them. If this occurs, the stan

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Stephen Frost
Greetings, * Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: > OK. I think this is perhaps a documentation bug, maybe a missing > warning when the master reads its configuration, and maybe (as you say) > a bad default value. If we consider it to be an issue worthy of a change then we

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Phil Endecott
Stephen Frost wrote: * Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: Stephen Frost wrote: >* Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: >>2018-08-11 00:12:15.536 UTC [7954] LOG: restored log file "0001000700D0" from archive >>2018-08-11 00:12:15.797 UTC [

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Stephen Frost
Greetings, * Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: > Stephen Frost wrote: > >* Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: > >>archive_command = 'ssh backup test ! -f backup/postgresql/archivedir/%f && > >> scp %p backup:backup/postgresql/archive

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread TalGloz
OK It worked. This is how I did it, hopefully it is right extern "C" { #include #include #include #include #include #include #include #include PG_MODULE_MAGIC; } #include #include #include #include #include // external compiled c++ library linked on running 'make' extern "C" { Dat

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Adrian Klaver
On 08/12/2018 12:53 PM, Phil Endecott wrote: Phil Endecott wrote: On the master, I have: wal_level = replica archive_mode = on archive_command = 'ssh backup test ! -f backup/postgresql/archivedir/%f && scp %p backup:backup/postgresql/archivedir/%f' On the slave I have: sta

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread TalGloz
Let me see if I understood you correctly. I cant have a code like this: extern "C" { int sum_of_numbers(){ std::vector numbers {23, 445, 64}; int sum = 0; for (auto &item : numbers){ sum += item; }

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Adrian Klaver
On 08/12/2018 12:25 PM, Phil Endecott wrote: Hi Adrian, Adrian Klaver wrote: On 08/11/2018 12:42 PM, Phil Endecott wrote: Hi Adrian, Adrian Klaver wrote: Looks like the master recycled the WAL's while the slave could not connect. Yes but... why is that a problem?  The master is copying the

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Phil Endecott
Phil Endecott wrote: > On the master, I have: > > wal_level = replica > archive_mode = on > archive_command = 'ssh backup test ! -f backup/postgresql/archivedir/%f && >scp %p backup:backup/postgresql/archivedir/%f' > > On the slave I have: > > standby_mode = 'on' > primary_conni

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Phil Endecott
Hi Adrian, Adrian Klaver wrote: On 08/11/2018 12:42 PM, Phil Endecott wrote: Hi Adrian, Adrian Klaver wrote: Looks like the master recycled the WAL's while the slave could not connect. Yes but... why is that a problem?  The master is copying the WALs to the backup server using scp, where th

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread Tom Lane
TalGloz writes: > But now my compiler throws some other errors when running make: > myfunc.cpp:29:10: error: conflicting declaration of C function ‘int64_t > sum_of_numbers()’ > int64_t sum_of_numbers(){ > ^~ Well, yeah, you forgot to repeat the argument list here. For t

Re: Replication failure, slave requesting old segments

2018-08-12 Thread Phil Endecott
Hi Stephen, Stephen Frost wrote: * Phil Endecott (spam_from_pgsql_li...@chezphil.org) wrote: archive_command = 'ssh backup test ! -f backup/postgresql/archivedir/%f && scp %p backup:backup/postgresql/archivedir/%f' This is really not a sufficient or particularly intelligent

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread Dmitry Igrishin
вс, 12 авг. 2018 г. в 21:40, TalGloz : > > I did it with the macros > > extern "C" { > Datum sum_of_numbers(PG_FUNCTION_ARGS); > PG_FUNCTION_INFO_V1(sum_of_numbers); > } > > But now my compiler throws some other errors when running make: > > g++ --std=c++17 -fPIC -Wall -Werror -g3 -O0 -o myfunc.o -

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread TalGloz
I did it with the macros extern "C" { Datum sum_of_numbers(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(sum_of_numbers); } But now my compiler throws some other errors when running make: g++ --std=c++17 -fPIC -Wall -Werror -g3 -O0 -o myfunc.o -c myfunc.cpp -I/usr/pgsql-10/include/server -L"/usr/local/

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread Tom Lane
TalGloz writes: > The error this time for PostgreSQL is: > *ERROR: could not find function information for function "sum_of_numbers" > HINT: SQL-callable functions need an accompanying > PG_FUNCTION_INFO_V1(funcname). > SQL state: 42883* Probably need extern "C" around the PG_FUNCTION_INFO_V1 m

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread TalGloz
OK now I have this code: 1: extern "C" { // The C header should go here 2: #include 3: #include 4: #include 5: #include 6: #include 7: #include 8: #include 9: #include 10: 11: PG_MODULE_MAGIC; 12: } 13: 14: // CPP header without extern "C" 15: #include 16: #include 1

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread Igor Korot
Hi, On Sun, Aug 12, 2018 at 12:05 PM, TalGloz wrote: > Hi, > > I've searched information about my problem in the archives and on the > internet, but it didn't help. I have this small myfunc.cpp > > 1: #include > 2: #include > 3: #include > 4: #include > 5: #include > 6: #include

Re: PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread Tom Lane
TalGloz writes: > I've searched information about my problem in the archives and on the > internet, but it didn't help. I have this small myfunc.cpp > [ that doesn't work ] > 16: #ifdef PG_MODULE_MAGIC > 17: PG_MODULE_MAGIC; > 18: #endif Hmm ... don't use an #ifdef there. If you don't have the

PostgreSQL C Language Extension with C++ Code

2018-08-12 Thread TalGloz
Hi, I've searched information about my problem in the archives and on the internet, but it didn't help. I have this small myfunc.cpp 1: #include 2: #include 3: #include 4: #include 5: #include 6: #include 7: #include 8: #include 9: #include 10: #include 11: #include 1