Thread: pg_sample

pg_sample

From
Patrick B
Date:
Hi guys,

I got a very big database, that I need to export (dump) into a new test server.

However, this new database test server doesn't need to have all the data. I would like to have only the first 100 rows(example) of each table in my database.

I'm using pg_sample to do that, but unfortunately it doesn't work well.
It doesn't get the first 100 rows. It gets random 100 rows.

Do you guys have any idea how could I do this?
Thanks
Patrick

Re: pg_sample

From
Michael Paquier
Date:
On Wed, Oct 19, 2016 at 9:24 AM, Patrick B <patrickbakerbr@gmail.com> wrote:
> However, this new database test server doesn't need to have all the data. I
> would like to have only the first 100 rows(example) of each table in my
> database.
>
> I'm using pg_sample to do that, but unfortunately it doesn't work well.
> It doesn't get the first 100 rows. It gets random 100 rows.

Why aren't 100 random rows enough to fulfill what you are looking for?
What you are trying here is to test the server with some sample data,
no? In this case, having the first 100 rows, or a set of random ones
should not matter much (never tried pg_sample to be honest).
--
Michael


Re: pg_sample

From
Patrick B
Date:


2016-10-19 13:39 GMT+13:00 Michael Paquier <michael.paquier@gmail.com>:
On Wed, Oct 19, 2016 at 9:24 AM, Patrick B <patrickbakerbr@gmail.com> wrote:
> However, this new database test server doesn't need to have all the data. I
> would like to have only the first 100 rows(example) of each table in my
> database.
>
> I'm using pg_sample to do that, but unfortunately it doesn't work well.
> It doesn't get the first 100 rows. It gets random 100 rows.

Why aren't 100 random rows enough to fulfill what you are looking for?
What you are trying here is to test the server with some sample data,
no? In this case, having the first 100 rows, or a set of random ones
should not matter much (never tried pg_sample to be honest).
--
Michael


Actually it does matter because there is some essential data that has to be in there so the code can work.

Re: pg_sample

From
Adrian Klaver
Date:
On 10/18/2016 06:30 PM, Patrick B wrote:
>
>
> 2016-10-19 13:39 GMT+13:00 Michael Paquier <michael.paquier@gmail.com
> <mailto:michael.paquier@gmail.com>>:
>
>     On Wed, Oct 19, 2016 at 9:24 AM, Patrick B <patrickbakerbr@gmail.com
>     <mailto:patrickbakerbr@gmail.com>> wrote:
>     > However, this new database test server doesn't need to have all the data. I
>     > would like to have only the first 100 rows(example) of each table in my
>     > database.
>     >
>     > I'm using pg_sample to do that, but unfortunately it doesn't work well.
>     > It doesn't get the first 100 rows. It gets random 100 rows.
>
>     Why aren't 100 random rows enough to fulfill what you are looking for?
>     What you are trying here is to test the server with some sample data,
>     no? In this case, having the first 100 rows, or a set of random ones
>     should not matter much (never tried pg_sample to be honest).
>     --
>     Michael
>
>
>
> Actually it does matter because there is some essential data that has to
> be in there so the code can work.

Well random does not know essential, it is after all random. If you want
to test specific cases then you will need to build appropriate data sets.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Melvin Davidson
Date:


On Tue, Oct 18, 2016 at 10:21 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 10/18/2016 06:30 PM, Patrick B wrote:


2016-10-19 13:39 GMT+13:00 Michael Paquier <michael.paquier@gmail.com
<mailto:michael.paquier@gmail.com>>:

    On Wed, Oct 19, 2016 at 9:24 AM, Patrick B <patrickbakerbr@gmail.com
    <mailto:patrickbakerbr@gmail.com>> wrote:
    > However, this new database test server doesn't need to have all the data. I
    > would like to have only the first 100 rows(example) of each table in my
    > database.
    >
    > I'm using pg_sample to do that, but unfortunately it doesn't work well.
    > It doesn't get the first 100 rows. It gets random 100 rows.

    Why aren't 100 random rows enough to fulfill what you are looking for?
    What you are trying here is to test the server with some sample data,
    no? In this case, having the first 100 rows, or a set of random ones
    should not matter much (never tried pg_sample to be honest).
    --
    Michael



Actually it does matter because there is some essential data that has to
be in there so the code can work.

Well random does not know essential, it is after all random. If you want to test specific cases then you will need to build appropriate data sets.


--
Adrian Klaver
adrian.klaver@aklaver.com



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

The following query should generate statements you can use to get the first 100 rows of every table.
You may need to tweak a bit as order is not guaranteed.

SELECT 'COPY ' || quote_ident(n.nspname) || '.' || quote_ident(c.relname)
    || ' TO '''
--    || 'C:\temp\'
    || '/tmp/'
    || quote_ident(n.nspname) || '_' || quote_ident(c.relname) || '.csv' || ''''
    || ' WITH CSV HEADER FORCE_QUOTE *;'
  FROM pg_class c
  JOIN pg_namespace n ON n.oid = c.relnamespace
 WHERE relkind = 'r'
   AND relname NOT LIKE 'pg_%'
   AND relname NOT LIKE 'sql_%'
   LIMIT 100;

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: pg_sample

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


Patrick B <patrickbakerbr@gmail.com> writes:
...
> However, this new database test server doesn't need to have all the data. I
> would like to have only the first 100 rows(example) of each table in my
> database.
...

This should do what you ask.

If the order does not matter, leave out the ORDER BY.

This assumes everything of interest is in the public schema.

$ createdb testdb
$ pg_dump realdb --schema-only | psql -q testdb
$ psql realdb

psql> \o dump.some.rows.sh
psql> select format($$psql realdb -c 'COPY (select * from %I order by 1 limit %s) TO STDOUT' | psql testdb -c 'COPY %I
FROMSTDIN' $$, table_name, 100, table_name) 
      from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE';
psql> \q

$ sh dump.some.rows.sh

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201610182256
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlgG4NkACgkQvJuQZxSWSsge4ACePhBOBtBFnGNxXt5qpY7X+w3o
d04AoKTzAgxcaqy8qfIE0LPuzG9x0KIU
=sS+m
-----END PGP SIGNATURE-----




Re: pg_sample

From
Charles Clavadetscher
Date:
Hello

On 10/19/2016 04:58 AM, Greg Sabino Mullane wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
> Patrick B <patrickbakerbr@gmail.com> writes:
> ...
>> However, this new database test server doesn't need to have all the data. I
>> would like to have only the first 100 rows(example) of each table in my
>> database.
> ...
>
> This should do what you ask.
>
> If the order does not matter, leave out the ORDER BY.
>
> This assumes everything of interest is in the public schema.
>
> $ createdb testdb
> $ pg_dump realdb --schema-only | psql -q testdb
> $ psql realdb
>
> psql> \o dump.some.rows.sh
> psql> select format($$psql realdb -c 'COPY (select * from %I order by 1 limit %s) TO STDOUT' | psql testdb -c 'COPY
%IFROM STDIN' $$, table_name, 100, table_name) 
>       from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE';
> psql> \q
>
> $ sh dump.some.rows.sh

I may be overseeing something, but what about dependencies between
tables, sequencies, indexes, etc.? I guess that if one takes the first
100 rows of a table referenced by another table, there is no guarantee
that in the first 100 rows of the referencing table there will not be
some foreign key that does not exist.

Regards
Charles

>
> - --
> Greg Sabino Mullane greg@turnstep.com
> End Point Corporation http://www.endpoint.com/
> PGP Key: 0x14964AC8 201610182256
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
> -----BEGIN PGP SIGNATURE-----
>
> iEYEAREDAAYFAlgG4NkACgkQvJuQZxSWSsge4ACePhBOBtBFnGNxXt5qpY7X+w3o
> d04AoKTzAgxcaqy8qfIE0LPuzG9x0KIU
> =sS+m
> -----END PGP SIGNATURE-----
>
>
>
>

--
Swiss PostgreSQL Users Group
c/o Charles Clavadetscher
Treasurer
Motorenstrasse 18
CH – 8005 Zürich

http://www.swisspug.org

+-----------------------+
|   ____  ______  ___   |
|  /    )/      \/   \  |
| (     / __    _\    ) |
|  \    (/ o)  ( o)   ) |
|   \_  (_  )   \ ) _/  |
|     \  /\_/    \)/    |
|      \/ <//|  |\\>    |
|           _|  |       |
|           \|_/        |
|                       |
| PostgreSQL 1996-2016  |
|  20 Years of Success  |
|                       |
+-----------------------+


Re: pg_sample

From
Adrian Klaver
Date:
On 10/18/2016 08:15 PM, Charles Clavadetscher wrote:
> Hello
>
> On 10/19/2016 04:58 AM, Greg Sabino Mullane wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: RIPEMD160
>>
>>
>> Patrick B <patrickbakerbr@gmail.com> writes:
>> ...
>>> However, this new database test server doesn't need to have all the
>>> data. I
>>> would like to have only the first 100 rows(example) of each table in my
>>> database.
>> ...
>>
>> This should do what you ask.
>>
>> If the order does not matter, leave out the ORDER BY.
>>
>> This assumes everything of interest is in the public schema.
>>
>> $ createdb testdb
>> $ pg_dump realdb --schema-only | psql -q testdb
>> $ psql realdb
>>
>> psql> \o dump.some.rows.sh
>> psql> select format($$psql realdb -c 'COPY (select * from %I order by
>> 1 limit %s) TO STDOUT' | psql testdb -c 'COPY %I FROM STDIN' $$,
>> table_name, 100, table_name)
>>       from information_schema.tables where table_schema = 'public' and
>> table_type = 'BASE TABLE';
>> psql> \q
>>
>> $ sh dump.some.rows.sh
>
> I may be overseeing something, but what about dependencies between
> tables, sequencies, indexes, etc.? I guess that if one takes the first
> 100 rows of a table referenced by another table, there is no guarantee
> that in the first 100 rows of the referencing table there will not be
> some foreign key that does not exist.

Well there is:

https://github.com/18F/rdbms-subsetter

That still does not guarantee that the rows selected cover your test
cases though.

>
> Regards
> Charles
>
>>
>> - --
>> Greg Sabino Mullane greg@turnstep.com
>> End Point Corporation http://www.endpoint.com/
>> PGP Key: 0x14964AC8 201610182256
>> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
>> -----BEGIN PGP SIGNATURE-----
>>
>> iEYEAREDAAYFAlgG4NkACgkQvJuQZxSWSsge4ACePhBOBtBFnGNxXt5qpY7X+w3o
>> d04AoKTzAgxcaqy8qfIE0LPuzG9x0KIU
>> =sS+m
>> -----END PGP SIGNATURE-----
>>
>>
>>
>>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Karsten Hilbert
Date:
On Wed, Oct 19, 2016 at 01:24:10PM +1300, Patrick B wrote:

> I'm using pg_sample to do that, but unfortunately it doesn't work well.
> It doesn't get the first 100 rows. It gets random 100 rows.
>
> Do you guys have any idea how could I do this?

For any relevant answer to this question you'll have to
define what "first" means in the context of "first 100 rows".

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Re: pg_sample

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> I may be overseeing something, but what about dependencies between
> tables, sequencies, indexes, etc.? I guess that if one takes the first
> 100 rows of a table referenced by another table, there is no guarantee
> that in the first 100 rows of the referencing table there will not be
> some foreign key that does not exist.

The only dependency that should matter is foreign keys, and yeah, if you
have those, all bets are off; one would need to write something very custom
indeed to slurp out the data. I could envision some workarounds, but it
really depends on exactly what the OP is trying to achieve.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201610191401
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlgHtV8ACgkQvJuQZxSWSsgrzQCglNFhkdnfg4ECC1l3l0F/Uqt0
ID4AnjGHOTR5Tsfn8MwmyBItTrOg1w7Y
=6qOO
-----END PGP SIGNATURE-----




Re: pg_sample

From
naveen12
Date:
i have installed postgresql on centos.
i want to use pg_sample.

Do i need to install that separately of it's included in the postgresql



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html


Re: pg_sample

From
Adrian Klaver
Date:
On 08/23/2018 12:10 AM, naveen12 wrote:
> i have installed postgresql on centos.
> i want to use pg_sample.
> 
> Do i need to install that separately of it's included in the postgresql

It is not included in the Postgres core or contrib packages. You will 
need to install it separately.

> 
> 
> 
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Naveen Dabas
Date:
sir from where should i install it.
I tried but  i didn't found separate  link for pg_sample 
can you help me in this 


thanks

On Thu, Aug 23, 2018 at 6:34 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 08/23/2018 12:10 AM, naveen12 wrote:
i have installed postgresql on centos.
i want to use pg_sample.

Do i need to install that separately of it's included in the postgresql

It is not included in the Postgres core or contrib packages. You will need to install it separately.




--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




--
Adrian Klaver
adrian.klaver@aklaver.com



--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Adrian Klaver
Date:
On 08/23/2018 07:39 AM, Naveen Dabas wrote:
> sir from where should i install it.
> I tried but  i didn't found separate  link for pg_sample
> can you help me in this

I am guessing it is this:

https://github.com/mla/pg_sample




-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Adrian Klaver
Date:
On 08/23/2018 07:39 AM, Naveen Dabas wrote:
> sir from where should i install it.
> I tried but  i didn't found separate  link for pg_sample
> can you help me in this


Something similar:

https://github.com/18F/rdbms-subsetter

It is Python based and can be pip installed.

> 
> 
> thanks
> 



-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Naveen Dabas
Date:
sir have taken pg_sample 
Now i want to run pg_sample with credential but i'm getting this error

Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192.
BEGIN failed--compilation aborted at ./pg_sample line 192.


can you help me in this

thanks 

On Thu, Aug 23, 2018 at 8:22 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 08/23/2018 07:39 AM, Naveen Dabas wrote:
sir from where should i install it.
I tried but  i didn't found separate  link for pg_sample
can you help me in this


Something similar:

https://github.com/18F/rdbms-subsetter

It is Python based and can be pip installed.



thanks




--
Adrian Klaver
adrian.klaver@aklaver.com



--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Ravi Krishna
Date:
>
> sir have taken pg_sample
> Now i want to run pg_sample with credential but i'm getting this error
>
> Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192. 
> BEGIN failed--compilation aborted at ./pg_sample line 192.

As is clear from the message, you need to install Perl DBI/DBD first.



Re: pg_sample

From
Abhinav Mehta
Date:
Solution, execute this on your linux terminal -

$ perl -MCPAN -e 'install Bundle::DBI'
$ perl -MCPAN -e 'install DBD::Pg'

> On 24-Aug-2018, at 6:13 PM, Ravi Krishna <sravikrishna@aol.com> wrote:
>
>>
>> sir have taken pg_sample
>> Now i want to run pg_sample with credential but i'm getting this error
>>
>> Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192. 
>> BEGIN failed--compilation aborted at ./pg_sample line 192.
>
> As is clear from the message, you need to install Perl DBI/DBD first.
>
>



Re: pg_sample

From
Naveen Dabas
Date:
Sir i'm getting error in both commands 

[root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install Bundle::DBI'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
[root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.



operating system =CentOS Linux release 7.5.1804 (Core)

thanks 


On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta <abhinav@metarain.com> wrote:
Solution, execute this on your linux terminal -

$ perl -MCPAN -e 'install Bundle::DBI'
$ perl -MCPAN -e 'install DBD::Pg'

> On 24-Aug-2018, at 6:13 PM, Ravi Krishna <sravikrishna@aol.com> wrote:
>
>>
>> sir have taken pg_sample
>> Now i want to run pg_sample with credential but i'm getting this error
>>
>> Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192.
>> BEGIN failed--compilation aborted at ./pg_sample line 192.
>
> As is clear from the message, you need to install Perl DBI/DBD first.
>
>




--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Paul Carlucci
Date:
sudo yum install perl-CPAN

Also do a "yum search perl-" and you should find most, if not all what you need natively packaged for your particular Linux distro.  You're better off just sticking with the pre-packaged perl modules unless you specifically need something special.

You'll find more modules if you also enable the EPEL yum repo by setting enabled=1 in the first section of /etc/yum.repos.d/epel.conf and rerunning that yum search command.

On Sun, Aug 26, 2018, 2:20 PM Naveen Dabas <naveen@paymonk.com> wrote:
Sir i'm getting error in both commands 

[root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install Bundle::DBI'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
[root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.



operating system =CentOS Linux release 7.5.1804 (Core)

thanks 


On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta <abhinav@metarain.com> wrote:
Solution, execute this on your linux terminal -

$ perl -MCPAN -e 'install Bundle::DBI'
$ perl -MCPAN -e 'install DBD::Pg'

> On 24-Aug-2018, at 6:13 PM, Ravi Krishna <sravikrishna@aol.com> wrote:
>
>>
>> sir have taken pg_sample
>> Now i want to run pg_sample with credential but i'm getting this error
>>
>> Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192.
>> BEGIN failed--compilation aborted at ./pg_sample line 192.
>
> As is clear from the message, you need to install Perl DBI/DBD first.
>
>




--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Naveen Dabas
Date:
Server encoding is UTF8
Client encoding is UTF8
Creating sample schema sampledb1
DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA in a read-only transaction at ./pg_sample line 296.
main::__ANON__('DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA i...', 'DBI::db=HASH(0xab2388)', undef) called at ./pg_sample line 478
Done.


can you help me in this 
thanks 

On Mon, Aug 27, 2018 at 11:16 AM, Naveen Dabas <naveen@paymonk.com> wrote:
Thanks for the help. 
But now i'm getting some different error as i rum this command 
./pg_sample -a -f file.sql --limit="user = 100" --schema=dbname -h hostname -U user -W password

I am not getting output and one file opens , in that file there id guide for pg_sample 
----
/tmp/9REOT5C

NAME
pg_sample - extract a small, sample dataset from a larger PostgreSQL
database while maintaining referential integrity.
=head1 SYNOPSIS
pg_sample [ option... ] [ dbname ]
=head1 DESCRIPTION
pg_sample is a utility for exporting a small, sample dataset from a
larger PostgreSQL database. The output and command-line options closely
resemble the pg_dump backup utility (although only the plain-text format
is supported).
The sample database produced includes all tables from the original,
maintains referential integrity, and supports circular dependencies.
To build an actual instance of the sample database, the output of this script
can be piped to the psql utility. For example, assuming we have an existing
PostgreSQL database named "mydb", a sample database could be constructed with:
  createdb sampledb
  pg_sample mydb | psql sampledb
and so on .......

On Mon, Aug 27, 2018 at 1:27 AM, Paul Carlucci <paul.carlucci@gmail.com> wrote:
sudo yum install perl-CPAN

Also do a "yum search perl-" and you should find most, if not all what you need natively packaged for your particular Linux distro.  You're better off just sticking with the pre-packaged perl modules unless you specifically need something special.

You'll find more modules if you also enable the EPEL yum repo by setting enabled=1 in the first section of /etc/yum.repos.d/epel.conf and rerunning that yum search command.

On Sun, Aug 26, 2018, 2:20 PM Naveen Dabas <naveen@paymonk.com> wrote:
Sir i'm getting error in both commands 

[root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install Bundle::DBI'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
[root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.



operating system =CentOS Linux release 7.5.1804 (Core)

thanks 


On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta <abhinav@metarain.com> wrote:
Solution, execute this on your linux terminal -

$ perl -MCPAN -e 'install Bundle::DBI'
$ perl -MCPAN -e 'install DBD::Pg'

> On 24-Aug-2018, at 6:13 PM, Ravi Krishna <sravikrishna@aol.com> wrote:
>
>>
>> sir have taken pg_sample
>> Now i want to run pg_sample with credential but i'm getting this error
>>
>> Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./pg_sample line 192.
>> BEGIN failed--compilation aborted at ./pg_sample line 192.
>
> As is clear from the message, you need to install Perl DBI/DBD first.
>
>




--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.



--
--
With Regards
Naveen Dabas
Ph. 9017298370




--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Adrian Klaver
Date:
On 08/26/2018 11:03 PM, Naveen Dabas wrote:
> Server encoding is UTF8
> Client encoding is UTF8
> Creating sample schema sampledb1
> DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA in a 
> read-only transaction at ./pg_sample line 296.
> main::__ANON__('DBD::Pg::db do failed: ERROR:  cannot execute CREATE 
> SCHEMA i...', 'DBI::db=HASH(0xab2388)', undef) called at ./pg_sample 
> line 478
> Done.
> 
> 
> can you help me in this

Yes, by suggesting you try something other then pg_sample. The last 
commit was 4 years ago and it does not seem to be up to date enough.

What sort of sampling do you want to do?

> thanks
> 
> On Mon, Aug 27, 2018 at 11:16 AM, Naveen Dabas <naveen@paymonk.com 
> <mailto:naveen@paymonk.com>> wrote:
> 
>     Thanks for the help.
>     But now i'm getting some different error as i rum this command
>     ./pg_sample -a -f file.sql --limit="user = 100" --schema=dbname -h
>     hostname -U user -W password
> 
>     I am not getting output and one file opens , in that file there id
>     guide for pg_sample
>     ----
>     /tmp/9REOT5C
> 
>     NAME
>     pg_sample - extract a small, sample dataset from a larger PostgreSQL
>     database while maintaining referential integrity.
>     =head1 SYNOPSIS
>     pg_sample [ option... ] [ dbname ]
>     =head1 DESCRIPTION
>     pg_sample is a utility for exporting a small, sample dataset from a
>     larger PostgreSQL database. The output and command-line options closely
>     resemble the pg_dump backup utility (although only the plain-text format
>     is supported).
>     The sample database produced includes all tables from the original,
>     maintains referential integrity, and supports circular dependencies.
>     To build an actual instance of the sample database, the output of
>     this script
>     can be piped to the psql utility. For example, assuming we have an
>     existing
>     PostgreSQL database named "mydb", a sample database could be
>     constructed with:
>        createdb sampledb
>        pg_sample mydb | psql sampledb
>     and so on .......
> 
>     On Mon, Aug 27, 2018 at 1:27 AM, Paul Carlucci
>     <paul.carlucci@gmail.com <mailto:paul.carlucci@gmail.com>> wrote:
> 
>         sudo yum install perl-CPAN
> 
>         Also do a "yum search perl-" and you should find most, if not
>         all what you need natively packaged for your particular Linux
>         distro.  You're better off just sticking with the pre-packaged
>         perl modules unless you specifically need something special.
> 
>         You'll find more modules if you also enable the EPEL yum repo by
>         setting enabled=1 in the first section of
>         /etc/yum.repos.d/epel.conf and rerunning that yum search command.
> 
>         On Sun, Aug 26, 2018, 2:20 PM Naveen Dabas <naveen@paymonk.com
>         <mailto:naveen@paymonk.com>> wrote:
> 
>             Sir i'm getting error in both commands
> 
>             [root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install Bundle::DBI'
>             Can't locate CPAN.pm in @INC (@INC contains:
>             /usr/local/lib64/perl5 /usr/local/share/perl5
>             /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
>             /usr/lib64/perl5 /usr/share/perl5 .).
>             BEGIN failed--compilation aborted.
>             [root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
>             Can't locate CPAN.pm in @INC (@INC contains:
>             /usr/local/lib64/perl5 /usr/local/share/perl5
>             /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
>             /usr/lib64/perl5 /usr/share/perl5 .).
>             BEGIN failed--compilation aborted.
> 
> 
> 
>             operating system =CentOS Linux release 7.5.1804 (Core)
> 
>             thanks
> 
> 
>             On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta
>             <abhinav@metarain.com <mailto:abhinav@metarain.com>> wrote:
> 
>                 Solution, execute this on your linux terminal -
> 
>                 $ perl -MCPAN -e 'install Bundle::DBI'
>                 $ perl -MCPAN -e 'install DBD::Pg'
> 
>                  > On 24-Aug-2018, at 6:13 PM, Ravi Krishna
>                 <sravikrishna@aol.com <mailto:sravikrishna@aol.com>> wrote:
>                  >
>                  >>
>                  >> sir have taken pg_sample
>                  >> Now i want to run pg_sample with credential but i'm
>                 getting this error
>                  >>
>                  >> Can't locate DBI.pm in @INC (@INC contains:
>                 /usr/local/lib64/perl5 /usr/local/share/perl5
>                 /usr/lib64/perl5/vendor_perl
>                 /usr/share/perl5/vendor_perl /usr/lib64/perl5
>                 /usr/share/perl5 .) at ./pg_sample line 192.
>                  >> BEGIN failed--compilation aborted at ./pg_sample
>                 line 192.
>                  >
>                  > As is clear from the message, you need to install
>                 Perl DBI/DBD first.
>                  >
>                  >
> 
> 
> 
> 
>             -- 
>             --
>             With Regards
>             Naveen Dabas
>             Ph. 9017298370
> 
> 
>             *Important Disclaimer:* Information contained in this email
>             is for the recipient primarily addressed to. If you are not
>             the primary recipient or are not supposed to receive this
>             email, you are advised to kindly delete the email or the
>             thread and notify of the error. The logo is a registered and
>             copyrighted property of *ACTAS TECHNOLOGIES PRIVATE
>             LIMITED*. Do not use it without authorization.
> 
> 
> 
> 
>     -- 
>     --
>     With Regards
>     Naveen Dabas
>     Ph. 9017298370
> 
> 
> 
> 
> -- 
> --
> With Regards
> Naveen Dabas
> Ph. 9017298370
> 
> 
> *Important Disclaimer:* Information contained in this email is for the 
> recipient primarily addressed to. If you are not the primary recipient 
> or are not supposed to receive this email, you are advised to kindly 
> delete the email or the thread and notify of the error. The logo is a 
> registered and copyrighted property of *ACTAS TECHNOLOGIES PRIVATE 
> LIMITED*. Do not use it without authorization.


-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
Naveen Dabas
Date:
actually i want limited data from the postgres database. But i don't want to use .csv



thanks

On Mon, Aug 27, 2018 at 7:42 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 08/26/2018 11:03 PM, Naveen Dabas wrote:
Server encoding is UTF8
Client encoding is UTF8
Creating sample schema sampledb1
DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA in a read-only transaction at ./pg_sample line 296.
main::__ANON__('DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA i...', 'DBI::db=HASH(0xab2388)', undef) called at ./pg_sample line 478
Done.


can you help me in this

Yes, by suggesting you try something other then pg_sample. The last commit was 4 years ago and it does not seem to be up to date enough.

What sort of sampling do you want to do?

thanks


On Mon, Aug 27, 2018 at 11:16 AM, Naveen Dabas <naveen@paymonk.com <mailto:naveen@paymonk.com>> wrote:

    Thanks for the help.
    But now i'm getting some different error as i rum this command
    ./pg_sample -a -f file.sql --limit="user = 100" --schema=dbname -h
    hostname -U user -W password

    I am not getting output and one file opens , in that file there id
    guide for pg_sample
    ----
    /tmp/9REOT5C

    NAME
    pg_sample - extract a small, sample dataset from a larger PostgreSQL
    database while maintaining referential integrity.
    =head1 SYNOPSIS
    pg_sample [ option... ] [ dbname ]
    =head1 DESCRIPTION
    pg_sample is a utility for exporting a small, sample dataset from a
    larger PostgreSQL database. The output and command-line options closely
    resemble the pg_dump backup utility (although only the plain-text format
    is supported).
    The sample database produced includes all tables from the original,
    maintains referential integrity, and supports circular dependencies.
    To build an actual instance of the sample database, the output of
    this script
    can be piped to the psql utility. For example, assuming we have an
    existing
    PostgreSQL database named "mydb", a sample database could be
    constructed with:
       createdb sampledb
       pg_sample mydb | psql sampledb
    and so on .......

    On Mon, Aug 27, 2018 at 1:27 AM, Paul Carlucci
    <paul.carlucci@gmail.com <mailto:paul.carlucci@gmail.com>> wrote:

        sudo yum install perl-CPAN

        Also do a "yum search perl-" and you should find most, if not
        all what you need natively packaged for your particular Linux
        distro.  You're better off just sticking with the pre-packaged
        perl modules unless you specifically need something special.

        You'll find more modules if you also enable the EPEL yum repo by
        setting enabled=1 in the first section of
        /etc/yum.repos.d/epel.conf and rerunning that yum search command.

        On Sun, Aug 26, 2018, 2:20 PM Naveen Dabas <naveen@paymonk.com
        <mailto:naveen@paymonk.com>> wrote:

            Sir i'm getting error in both commands

            [root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install Bundle::DBI'
            Can't locate CPAN.pm in @INC (@INC contains:
            /usr/local/lib64/perl5 /usr/local/share/perl5
            /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
            /usr/lib64/perl5 /usr/share/perl5 .).
            BEGIN failed--compilation aborted.
            [root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
            Can't locate CPAN.pm in @INC (@INC contains:
            /usr/local/lib64/perl5 /usr/local/share/perl5
            /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
            /usr/lib64/perl5 /usr/share/perl5 .).
            BEGIN failed--compilation aborted.



            operating system =CentOS Linux release 7.5.1804 (Core)

            thanks


            On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta
            <abhinav@metarain.com <mailto:abhinav@metarain.com>> wrote:

                Solution, execute this on your linux terminal -

                $ perl -MCPAN -e 'install Bundle::DBI'
                $ perl -MCPAN -e 'install DBD::Pg'

                 > On 24-Aug-2018, at 6:13 PM, Ravi Krishna
                <sravikrishna@aol.com <mailto:sravikrishna@aol.com>> wrote:
                 >
                 >>
                 >> sir have taken pg_sample
                 >> Now i want to run pg_sample with credential but i'm
                getting this error
                 >>
                 >> Can't locate DBI.pm in @INC (@INC contains:
                /usr/local/lib64/perl5 /usr/local/share/perl5
                /usr/lib64/perl5/vendor_perl
                /usr/share/perl5/vendor_perl /usr/lib64/perl5
                /usr/share/perl5 .) at ./pg_sample line 192.
                 >> BEGIN failed--compilation aborted at ./pg_sample
                line 192.
                 >
                 > As is clear from the message, you need to install
                Perl DBI/DBD first.
                 >
                 >




            --             --
            With Regards
            Naveen Dabas
            Ph. 9017298370


            *Important Disclaimer:* Information contained in this email
            is for the recipient primarily addressed to. If you are not
            the primary recipient or are not supposed to receive this
            email, you are advised to kindly delete the email or the
            thread and notify of the error. The logo is a registered and
            copyrighted property of *ACTAS TECHNOLOGIES PRIVATE
            LIMITED*. Do not use it without authorization.




    --     --
    With Regards
    Naveen Dabas
    Ph. 9017298370




--
--
With Regards
Naveen Dabas
Ph. 9017298370


*Important Disclaimer:* Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of *ACTAS TECHNOLOGIES PRIVATE LIMITED*. Do not use it without authorization.


--
Adrian Klaver
adrian.klaver@aklaver.com



--
--
With Regards
Naveen Dabas
Ph. 9017298370


Important Disclaimer: Information contained in this email is for the recipient primarily addressed to. If you are not the primary recipient or are not supposed to receive this email, you are advised to kindly delete the email or the thread and notify of the error. The logo is a registered and copyrighted property of ACTAS TECHNOLOGIES PRIVATE LIMITED. Do not use it without authorization.

Re: pg_sample

From
Adrian Klaver
Date:
On 08/27/2018 08:33 AM, Naveen Dabas wrote:
> actually i want limited data from the postgres database. But i don't 
> want to use .csv

Does the sample need to include parent/child relationships?

In Postgres 9.5+ there is TABLESAMPLE:

https://www.postgresql.org/docs/10/static/sql-select.html

So you can do something like:

select * from plant1 TABLESAMPLE system (25);

on a single table.

I could see doing the above in a program and INSERTing the output to 
another database.

> 
> 
> 
> thanks
> 
> On Mon, Aug 27, 2018 at 7:42 PM, Adrian Klaver 
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 08/26/2018 11:03 PM, Naveen Dabas wrote:
> 
>         Server encoding is UTF8
>         Client encoding is UTF8
>         Creating sample schema sampledb1
>         DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA in a
>         read-only transaction at ./pg_sample line 296.
>         main::__ANON__('DBD::Pg::db do failed: ERROR:  cannot execute
>         CREATE SCHEMA i...', 'DBI::db=HASH(0xab2388)', undef) called at
>         ./pg_sample line 478
>         Done.
> 
> 
>         can you help me in this
> 
> 
>     Yes, by suggesting you try something other then pg_sample. The last
>     commit was 4 years ago and it does not seem to be up to date enough.
> 
>     What sort of sampling do you want to do?
> 
>         thanks
> 
> 
>         On Mon, Aug 27, 2018 at 11:16 AM, Naveen Dabas
>         <naveen@paymonk.com <mailto:naveen@paymonk.com>
>         <mailto:naveen@paymonk.com <mailto:naveen@paymonk.com>>> wrote:
> 
>              Thanks for the help.
>              But now i'm getting some different error as i rum this command
>              ./pg_sample -a -f file.sql --limit="user = 100"
>         --schema=dbname -h
>              hostname -U user -W password
> 
>              I am not getting output and one file opens , in that file
>         there id
>              guide for pg_sample
>              ----
>              /tmp/9REOT5C
> 
>              NAME
>              pg_sample - extract a small, sample dataset from a larger
>         PostgreSQL
>              database while maintaining referential integrity.
>              =head1 SYNOPSIS
>              pg_sample [ option... ] [ dbname ]
>              =head1 DESCRIPTION
>              pg_sample is a utility for exporting a small, sample
>         dataset from a
>              larger PostgreSQL database. The output and command-line
>         options closely
>              resemble the pg_dump backup utility (although only the
>         plain-text format
>              is supported).
>              The sample database produced includes all tables from the
>         original,
>              maintains referential integrity, and supports circular
>         dependencies.
>              To build an actual instance of the sample database, the
>         output of
>              this script
>              can be piped to the psql utility. For example, assuming we
>         have an
>              existing
>              PostgreSQL database named "mydb", a sample database could be
>              constructed with:
>                 createdb sampledb
>                 pg_sample mydb | psql sampledb
>              and so on .......
> 
>              On Mon, Aug 27, 2018 at 1:27 AM, Paul Carlucci
>              <paul.carlucci@gmail.com <mailto:paul.carlucci@gmail.com>
>         <mailto:paul.carlucci@gmail.com
>         <mailto:paul.carlucci@gmail.com>>> wrote:
> 
>                  sudo yum install perl-CPAN
> 
>                  Also do a "yum search perl-" and you should find most,
>         if not
>                  all what you need natively packaged for your particular
>         Linux
>                  distro.  You're better off just sticking with the
>         pre-packaged
>                  perl modules unless you specifically need something
>         special.
> 
>                  You'll find more modules if you also enable the EPEL
>         yum repo by
>                  setting enabled=1 in the first section of
>                  /etc/yum.repos.d/epel.conf and rerunning that yum
>         search command.
> 
>                  On Sun, Aug 26, 2018, 2:20 PM Naveen Dabas
>         <naveen@paymonk.com <mailto:naveen@paymonk.com>
>                  <mailto:naveen@paymonk.com
>         <mailto:naveen@paymonk.com>>> wrote:
> 
>                      Sir i'm getting error in both commands
> 
>                      [root@ip-88-8-8-17 ~]#  perl -MCPAN -e 'install
>         Bundle::DBI'
>                      Can't locate CPAN.pm in @INC (@INC contains:
>                      /usr/local/lib64/perl5 /usr/local/share/perl5
>                      /usr/lib64/perl5/vendor_perl
>         /usr/share/perl5/vendor_perl
>                      /usr/lib64/perl5 /usr/share/perl5 .).
>                      BEGIN failed--compilation aborted.
>                      [root@ip-88-8-8-17 ~]# perl -MCPAN -e 'install DBD::Pg'
>                      Can't locate CPAN.pm in @INC (@INC contains:
>                      /usr/local/lib64/perl5 /usr/local/share/perl5
>                      /usr/lib64/perl5/vendor_perl
>         /usr/share/perl5/vendor_perl
>                      /usr/lib64/perl5 /usr/share/perl5 .).
>                      BEGIN failed--compilation aborted.
> 
> 
> 
>                      operating system =CentOS Linux release 7.5.1804 (Core)
> 
>                      thanks
> 
> 
>                      On Fri, Aug 24, 2018 at 6:16 PM, Abhinav Mehta
>                      <abhinav@metarain.com <mailto:abhinav@metarain.com>
>         <mailto:abhinav@metarain.com <mailto:abhinav@metarain.com>>> wrote:
> 
>                          Solution, execute this on your linux terminal -
> 
>                          $ perl -MCPAN -e 'install Bundle::DBI'
>                          $ perl -MCPAN -e 'install DBD::Pg'
> 
>                           > On 24-Aug-2018, at 6:13 PM, Ravi Krishna
>                          <sravikrishna@aol.com
>         <mailto:sravikrishna@aol.com> <mailto:sravikrishna@aol.com
>         <mailto:sravikrishna@aol.com>>> wrote:
>                           >
>                           >>
>                           >> sir have taken pg_sample
>                           >> Now i want to run pg_sample with credential
>         but i'm
>                          getting this error
>                           >>
>                           >> Can't locate DBI.pm in @INC (@INC contains:
>                          /usr/local/lib64/perl5 /usr/local/share/perl5
>                          /usr/lib64/perl5/vendor_perl
>                          /usr/share/perl5/vendor_perl /usr/lib64/perl5
>                          /usr/share/perl5 .) at ./pg_sample line 192.
>                           >> BEGIN failed--compilation aborted at
>         ./pg_sample
>                          line 192.
>                           >
>                           > As is clear from the message, you need to
>         install
>                          Perl DBI/DBD first.
>                           >
>                           >
> 
> 
> 
> 
>                      --             --
>                      With Regards
>                      Naveen Dabas
>                      Ph. 9017298370
> 
> 
>                      *Important Disclaimer:* Information contained in
>         this email
>                      is for the recipient primarily addressed to. If you
>         are not
>                      the primary recipient or are not supposed to
>         receive this
>                      email, you are advised to kindly delete the email
>         or the
>                      thread and notify of the error. The logo is a
>         registered and
>                      copyrighted property of *ACTAS TECHNOLOGIES PRIVATE
>                      LIMITED*. Do not use it without authorization.
> 
> 
> 
> 
>              --     --
>              With Regards
>              Naveen Dabas
>              Ph. 9017298370
> 
> 
> 
> 
>         -- 
>         --
>         With Regards
>         Naveen Dabas
>         Ph. 9017298370
> 
> 
>         *Important Disclaimer:* Information contained in this email is
>         for the recipient primarily addressed to. If you are not the
>         primary recipient or are not supposed to receive this email, you
>         are advised to kindly delete the email or the thread and notify
>         of the error. The logo is a registered and copyrighted property
>         of *ACTAS TECHNOLOGIES PRIVATE LIMITED*. Do not use it without
>         authorization.
> 
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 
> 
> 
> -- 
> --
> With Regards
> Naveen Dabas
> Ph. 9017298370
> 
> 
> *Important Disclaimer:* Information contained in this email is for the 
> recipient primarily addressed to. If you are not the primary recipient 
> or are not supposed to receive this email, you are advised to kindly 
> delete the email or the thread and notify of the error. The logo is a 
> registered and copyrighted property of *ACTAS TECHNOLOGIES PRIVATE 
> LIMITED*. Do not use it without authorization.


-- 
Adrian Klaver
adrian.klaver@aklaver.com


Re: pg_sample

From
"Daniel Verite"
Date:
    Naveen Dabas wrote:

> Creating sample schema sampledb1
> DBD::Pg::db do failed: ERROR:  cannot execute CREATE SCHEMA in a read-only
> transaction at ./pg_sample line 296.

Maybe you ran this on a hot standby? It can't work because
this program needs to write data into the database,
which is not allowed outside of the primary node.

Or you may have default_transaction_read_only set to true
for the particular db/user of the connection.
https://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite