Re: [GENERAL] Generating sample data

2016-12-27 Thread bto...@computer.org
- Original Message -
> From: "Rich Shepard" 
> To: pgsql-general@postgresql.org
> Sent: Tuesday, December 27, 2016 7:23:46 PM
> Subject: Re: [GENERAL] Generating sample data
> 
> On Tue, 27 Dec 2016, Adrian Klaver wrote:
> 
> > As it happens there is a Python version of the a fore mentioned faker:
> > https://pypi.python.org/pypi/Faker/0.7.7
> 
> Adrian,
> 
>Impressive and complete. It will generate all the data I need.
> 


This is kind of fun:


https://github.com/bmtober/groan


I had to hunt down the original author from the 1990's, which was when I 
originally downloaded from his personal web site at
 

http://raingod.com/raingod/resources/Programming/Perl/Software/Groan/


The initial commit on that github page is the original source as provided by 
Mr. McIntyre. 

In a subsequent commit, I removed some of the original code that formatted for 
HTML output, leaving just plain text, and also posted an example grammar for 
generating fake names and strings that look like social security numbers (i.e., 
a U.S. taxpayer identification). 

The script will generate duplicates, but you can do something like 

for n in {1..20}
do 
   groan.pl ssn.gn
done | sort -u

to get unique source data.

By defining other custom grammars, you could potentially generate all kinds of 
data.

-- B



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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, Adrian Klaver wrote:


As it happens there is a Python version of the a fore mentioned faker:
https://pypi.python.org/pypi/Faker/0.7.7


Adrian,

  Impressive and complete. It will generate all the data I need.

Many thanks,

Rich


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


Re: [GENERAL] LYDB: What advice about stored procedures and other server side code?

2016-12-27 Thread Alban Hertroys

> On 27 Dec 2016, at 23:03, Guyren Howe  wrote:
> 
> I am putting together some advice for developers about getting the most out 
> of SQL servers in general and Postgres in particular. I have in mind the 
> likes of most web developers, who through ignorance or a strange cultural 
> preference that has emerged, tend to treat their database server as a dumb 
> data bucket.
> 
> I call the project Love Your Database (LYDB). It is starting as a series of 
> blog posts:
> 
> https://medium.com/@gisborne/love-your-database-lydb-23c69f480a1d#.4jngp2rcb
> https://medium.com/@gisborne/love-your-database-simple-validations-68d5d6d0bbf3#.az4o2s152
> 
> I would next like to cover server-side code such as stored procedures and 
> triggers.

I think there's an objection that most developers would come up with: Namely 
that stored procedures living in the central relational database can usually 
not be changed as easily as client-side code, without disrupting development 
(or worse, operation of the production system) for other users. I think that 
needs some thought - I don't have the answer to that one.

IMO, as long as those stored procedures are part of the model (ensuring data 
integrity, interpreting database values, etc.), there shouldn't be a problem, 
but it's a terrain I haven't trodden much. There are things you usually don't 
want to handle at the database side, such as firing off other applications to 
perform tasks or user interface related operations, things like that. I once 
was tasked with writing a library on a database server (Oracle 8i) to handle 
printing of data and sending out faxes etc. That was a nightmare and in 
hindsight it just doesn't belong in a database. That's a task for middleware. 
Where the dividing line is is probably an interesting topic.

Another thought related to seeing the database as a model server; since we're 
apparently in the model-view-controller paradigm, it seems to me that database 
views would probably be useful to the view-part of MVC. That's just something 
that struck me to make more than a bit of sense…
Of course, for the actual view in the MVC paradigm there should be some kind of 
user interface, but database views could be really useful in preparing the data 
required for those, to make it fit the shape of the view.

So far I like what you're writing, so keep it coming!

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, Adrian Klaver wrote:


As it happens there is a Python version of the a fore mentioned faker:
https://pypi.python.org/pypi/Faker/0.7.7
It was I use to generate fake/sample data.


Adrian,

  Aha! That's a great start for me.

Many thanks,

Rich


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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, Adrian Klaver wrote:


What sort of data do you want to create?


Adrian,

  Various text, date, and numeric values.


If it is data specific to a field of study then things might get trickier.


  It's not a common database. I'll probably need to cobble together generic
data of the appropriate types myself.

Thanks,

Rich


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


Re: [GENERAL] LYDB: What advice about stored procedures and other server side code?

2016-12-27 Thread Steve Atkins

> On Dec 27, 2016, at 2:03 PM, Guyren Howe  wrote:
> 
> I am putting together some advice for developers about getting the most out 
> of SQL servers in general and Postgres in particular. I have in mind the 
> likes of most web developers, who through ignorance or a strange cultural 
> preference that has emerged, tend to treat their database server as a dumb 
> data bucket.
> 
> I call the project Love Your Database (LYDB). It is starting as a series of 
> blog posts:
> 
> https://medium.com/@gisborne/love-your-database-lydb-23c69f480a1d#.4jngp2rcb
> https://medium.com/@gisborne/love-your-database-simple-validations-68d5d6d0bbf3#.az4o2s152
> 
> I would next like to cover server-side code such as stored procedures and 
> triggers.
> 
> I am inclined to advise folks to use PL/V8 on Postgres, because it is a 
> reasonable language, everyone knows it, it has good string functions, decent 
> performance and it tends to be installed everywhere (in particular, Amazon 
> RDF offers it).
> 

Think hard about the "impedance mismatch" between parts of the system.

pl/pgsql uses sql data types and operators, and so interfaces very cleanly with 
the rest of postgresql. pl/v8 uses javascript data types and *for database 
related things* is likely to be a less perfect match to the rest of the system 
- as it's translating (or, in some cases, failing to translate) between sql 
data types and javascript data types that may not be entirely compatible, or 
which may not exist at all.

So if your functions are mostly doing databasey things, pl/pgsql may well be a 
better choice. If they're mostly doing appy things, that just happen to be in 
the database, then pl/v8 may be a better choice (but so might just doing the 
work in the app, perhaps with some listen/notify assistance).

Most of the functions I write are short trigger functions, or data 
wrapper/modification functions for migration or making business logic available 
for SQL. For the majority of those I find pl/pgsql the best match (if I can't 
get away with sql functions).

If you're trying to convince people to get the most out of their database, 
pushing them towards pl/v8 as their first choice of embedded language might not 
be the best path. (That it might encourage them to write code to iterate 
through tables rather than taking advantage of SQL where they can might be a 
thing too).

Cheers,
  Steve


> Broadly, what advice should I offer that isn’t obvious? Not just about PL/V8 
> but server side code in general.
> 
> TIA



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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Adrian Klaver

On 12/27/2016 12:06 PM, Rich Shepard wrote:

On Tue, 27 Dec 2016, Steve Crawford wrote:


You could start here:
http://www.softwaretestingmagazine.com/tools/open-source-test-data-generators/




I have rolled my own on occasion by just pulling some public lists of
most
common given names and family names and toing a full-join. Same for city,
streets, etc.


Steve,

  Thanks very much for the URL. One application is small (7 tables), the
other is three times that size (23 tables). If I need to find public domain
data on the Web, I'll do that.


What sort of data do you want to create?

If it is the standard contact information then the previously mentioned 
tools are sufficient.


If it is data specific to a field of study then things might get trickier.



Much appreciated,

Rich





--
Adrian Klaver
adrian.kla...@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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Adrian Klaver

On 12/27/2016 02:23 PM, Adrian Klaver wrote:

On 12/27/2016 12:03 PM, Rich Shepard wrote:

On Tue, 27 Dec 2016, Greg Navis wrote:


In the Ruby land there's a gem called faker
 that allows you to generate fake data.
However, I'm not sure it can generate data based on a schema so a little
bit of scripting my be necessary. Would this approach work for you?


Greg,

  I work in Python, not Ruby, so this might be too big of a hurdle.


As it happens there is a Python version of the a fore mentioned faker:

https://pypi.python.org/pypi/Faker/0.7.7

It was I use to generate fake/sample data.

Ugh.

It is what I use to generate fake/sample data.

Memo to self: Do one thing at a time!





Thanks,

Rich








--
Adrian Klaver
adrian.kla...@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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Adrian Klaver

On 12/27/2016 12:03 PM, Rich Shepard wrote:

On Tue, 27 Dec 2016, Greg Navis wrote:


In the Ruby land there's a gem called faker
 that allows you to generate fake data.
However, I'm not sure it can generate data based on a schema so a little
bit of scripting my be necessary. Would this approach work for you?


Greg,

  I work in Python, not Ruby, so this might be too big of a hurdle.


As it happens there is a Python version of the a fore mentioned faker:

https://pypi.python.org/pypi/Faker/0.7.7

It was I use to generate fake/sample data.



Thanks,

Rich





--
Adrian Klaver
adrian.kla...@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


[GENERAL] LYDB: What advice about stored procedures and other server side code?

2016-12-27 Thread Guyren Howe
I am putting together some advice for developers about getting the most out of 
SQL servers in general and Postgres in particular. I have in mind the likes of 
most web developers, who through ignorance or a strange cultural preference 
that has emerged, tend to treat their database server as a dumb data bucket.

I call the project Love Your Database (LYDB). It is starting as a series of 
blog posts:

https://medium.com/@gisborne/love-your-database-lydb-23c69f480a1d#.4jngp2rcb 

https://medium.com/@gisborne/love-your-database-simple-validations-68d5d6d0bbf3#.az4o2s152
 


I would next like to cover server-side code such as stored procedures and 
triggers.

I am inclined to advise folks to use PL/V8 on Postgres, because it is a 
reasonable language, everyone knows it, it has good string functions, decent 
performance and it tends to be installed everywhere (in particular, Amazon RDF 
offers it).

Broadly, what advice should I offer that isn’t obvious? Not just about PL/V8 
but server side code in general.

TIA

Re: [GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, Steve Crawford wrote:


You could start here:
http://www.softwaretestingmagazine.com/tools/open-source-test-data-generators/



I have rolled my own on occasion by just pulling some public lists of most
common given names and family names and toing a full-join. Same for city,
streets, etc.


Steve,

  Thanks very much for the URL. One application is small (7 tables), the
other is three times that size (23 tables). If I need to find public domain
data on the Web, I'll do that.

Much appreciated,

Rich


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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Steve Crawford
On Tue, Dec 27, 2016 at 12:01 PM, Steve Crawford <
scrawf...@pinpointresearch.com> wrote:

> You could start here:
> http://www.softwaretestingmagazine.com/tools/open-source-test-data-
> generators/
>
> I have rolled my own on occasion by just pulling some public lists of most
> common given names and family names and toing a full-join. Same for city,
> streets, etc.
>
> -Steve
>
> On Tue, Dec 27, 2016 at 11:23 AM, Rich Shepard 
> wrote:
>
>>   My previous databases used real client (or my own) data; now I want to
>> generate sample data for the tables in the two applications I'm
>> developing.
>> My web search finds a bunch of pricey (IMO) commercial products.
>>
>>   Are there any open source data generators that can provide sample data
>> based on each table's schema?
>>
>> TIA,
>>
>> Rich
>>
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
Sorry, "doing" a full-join. Which also leads to lots of fun cross-cultural
names like "Muhammad Wang" and "Santiago O'Leary".

Cheers,
Steve


Re: [GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, Greg Navis wrote:


In the Ruby land there's a gem called faker
 that allows you to generate fake data.
However, I'm not sure it can generate data based on a schema so a little
bit of scripting my be necessary. Would this approach work for you?


Greg,

  I work in Python, not Ruby, so this might be too big of a hurdle.

Thanks,

Rich


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


Re: [GENERAL] Generating sample data

2016-12-27 Thread Steve Crawford
You could start here:
http://www.softwaretestingmagazine.com/tools/open-source-test-data-generators/

I have rolled my own on occasion by just pulling some public lists of most
common given names and family names and toing a full-join. Same for city,
streets, etc.

-Steve

On Tue, Dec 27, 2016 at 11:23 AM, Rich Shepard 
wrote:

>   My previous databases used real client (or my own) data; now I want to
> generate sample data for the tables in the two applications I'm developing.
> My web search finds a bunch of pricey (IMO) commercial products.
>
>   Are there any open source data generators that can provide sample data
> based on each table's schema?
>
> TIA,
>
> Rich
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


Re: [GENERAL] Generating sample data

2016-12-27 Thread Greg Navis
In the Ruby land there's a gem called faker
 that allows you to generate fake data.
However, I'm not sure it can generate data based on a schema so a little
bit of scripting my be necessary. Would this approach work for you?

Yours
Greg


[GENERAL] Generating sample data

2016-12-27 Thread Rich Shepard

  My previous databases used real client (or my own) data; now I want to
generate sample data for the tables in the two applications I'm developing.
My web search finds a bunch of pricey (IMO) commercial products.

  Are there any open source data generators that can provide sample data
based on each table's schema?

TIA,

Rich




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


Re: [GENERAL] Error in column constraint syntax

2016-12-27 Thread Rich Shepard

On Tue, 27 Dec 2016, David G. Johnston wrote:


​5.3.1 is instructional.  The SQL Command chapter is the
authoritative source for syntax.


David,

  I'll read that, too.


CHECK ( expression ) [ NO INHERIT ] |   -- you are missing the mandatory (
) surrounding your expression
All of the examples in 5.3.1 have a "(" following the word CHECK as well...


  Yes, I see now that I misplaced the opening parenthesis and missed the
second closing parenthesis at the end of the IN list.

  I thought I had tested this syntax; obviously I did not.

Thanks,

Rich



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


Re: [GENERAL] Error in column constraint syntax

2016-12-27 Thread David G. Johnston
On Tue, Dec 27, 2016 at 9:39 AM, Rich Shepard 
wrote:

>   I'm encountering DDL syntax errors using postgres-9.6.1 that I've not
> before seen, and I'm having a difficult time finding the cause when reading
> the appropriate sections of the manual; Section 5.3.1 in this case:
>

​5.3.1 is instructional.  The SQL Command chapter is the authoritative
source for syntax.


> CREATE TABLE Agencies (
>   org_name VARCHAR(48) PRIMARY KEY,
>   acronym VARCHAR(8) DEFAULT ' ',
>   org_lvl VARCHAR(8) DEFAULT 'State'
>  CONSTRAINT invalid_agency_level
>  CHECK org_lvl IN ('Federal', 'State', 'County', 'City', 'Local',
> 'Regional'),
>   website VARCHAR(64) DEFAULT ' ',
>   created_at TIMESTAMP,
>   created_by TEXT NOT NULL,
>   updated_at TIMESTAMP,
>   updated_by TEXT NOT NULL,
>   comment TEXT
> );
>
>   psql reports:
>
> :86: ERROR:  syntax error at or near "org_lvl"
> LINE 6:  CHECK org_lvl IN ('Federal', 'State', 'County', 'City',...
>^
>   Having a default value or a named constraint makes no difference, and the
> maximum size of the org_lvl column is that of the longest string so I am
> not
> seeing the source of my error.
>

​https://www.postgresql.org/docs/9.6/static/sql-createtable.html

CHECK ( expression ) [ NO INHERIT ] |   -- you are missing the mandatory (
) surrounding your expression
​
All of the examples in 5.3.1 have a "(" following the word CHECK as well...


>   Where, other than Section 5.3.1 of the manual can I learn why there's an
> error?
> ​
>

If the error message in question doesn't provide a sufficient level of
detail I'm doubting that anything in the documentation is going to help
with diagnosis.

If you just mean where can you learn what is correct/expected then the SQL
Commands chapter is the authoritative source for syntax and usage.

David J.

​


[GENERAL] Error in column constraint syntax

2016-12-27 Thread Rich Shepard

  I'm encountering DDL syntax errors using postgres-9.6.1 that I've not
before seen, and I'm having a difficult time finding the cause when reading
the appropriate sections of the manual; Section 5.3.1 in this case:

CREATE TABLE Agencies (
  org_name VARCHAR(48) PRIMARY KEY,
  acronym VARCHAR(8) DEFAULT ' ',
  org_lvl VARCHAR(8) DEFAULT 'State'
 CONSTRAINT invalid_agency_level
 CHECK org_lvl IN ('Federal', 'State', 'County', 'City', 'Local', 
'Regional'),
  website VARCHAR(64) DEFAULT ' ',
  created_at TIMESTAMP,
  created_by TEXT NOT NULL,
  updated_at TIMESTAMP,
  updated_by TEXT NOT NULL,
  comment TEXT
);

  psql reports:

:86: ERROR:  syntax error at or near "org_lvl"
LINE 6:  CHECK org_lvl IN ('Federal', 'State', 'County', 'City',...
   ^
  Having a default value or a named constraint makes no difference, and the
maximum size of the org_lvl column is that of the longest string so I am not
seeing the source of my error.

  Where, other than Section 5.3.1 of the manual can I learn why there's an
error?

  I also have several errors of 'table not found' yet to be understood and 
resolved
but this one is at the top of the file.

TIA,

Rich


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


Re: [GENERAL] Windows installation - could not connect to server: Connection refused (0x0000274D/10061)

2016-12-27 Thread Adrian Klaver

On 12/26/2016 11:43 PM, thomas.deboben@rohde-schwarz.com wrote:


This has worked for different version, but now we get sometimes

trouble


Which version did it work on?

I'm working with PostgreSQL 9.5.0.1.
We download the Win x86-32 and Win x86-64 installation packages from


http://www.enterprisedb.com/products-services-training/pgdownload#windows


That is what you are using now but what where you using when, from first
post:

"This has worked for different version, but now we get sometimes trouble
..."


I ment different versions fo our product.
But I had also installer including PostgreSQL 9.3.4.1, 9.3.6.1 and 9.4.4.3.


So does the issue follow the change in your product version or the 
change in Postgres version?


In other words do the Postgres 9.4- versions install correctly with the 
new version of your product?


Also what changed with the new version of your product, in particular 
with the install process?





So far I wasn't able to reproduce this error by my self, but I know

from

about 5 issues inside the last month.
As I'm not able to reproduce I would appreciate any help from you to
find out what causes this error.


The error is pretty straight forward the server cannot be found at
localhost on port 5432, so:

Yes we use the standard port 5432


1) Do you know that the server is actually up and running at the point
you run the scripts?

Atually I havn't really checked when the installer will start the

service.

And as I said, I'm not able to get this error reproduced.


Seems it would be helpful to put something in the script to check the
server status and log it before trying to connect to it.


How can I check the server status?
Is this simply if the postgres service is running, or if some sql
command can connect the postgres port?


Since the issues seem to be with connecting, I would say testing for a 
connection using psql would be the way to go.








To me indicates this is an order of execution issue. The script is
running the connect/create scripts before the server is up and available
for connections.



But the first failing call is inside the original PostgreSQL installer
package,
where I have no influence on.
So already here is the problem.


Yeah, I missed that earlier.



This is from bitrock_installer.log
...
[14:58:49] Installing the adminpack module in the postgres database...
Executing C:\Program Files\PostgreSQL\9.5\bin\psql.exe -c "CREATE
EXTENSION adminpack" -d postgres
Script exit code: 2
...

But the lines above seems to be fine
...
Starting the database server...
Executing cscript //NoLogo "C:\Program
Files\PostgreSQL\9.5\installer\server\startserver.vbs" postgres
Script exit code: 0

Script output:
 Starting postgres
Service postgres started successfully
startserver.vbs ran to completion
...


I do not install on Windows so this is getting a bit out of my league.

Is the above from the install log?

If so can you show the entire install log?







All installations do run on Windows 7 Pro x64.

Best regards,
   Thomas Deboben



--
Adrian Klaver
adrian.kla...@aklaver.com


Many thanks,
  Thomas

--
Adrian Klaver
adrian.kla...@aklaver.com


Thanks,
 Thomas



--
Adrian Klaver
adrian.kla...@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


Re: [GENERAL] Windows installation - could not connect to server: Connection refused (0x0000274D/10061)

2016-12-27 Thread Thomas . Deboben . ext
>Von:   Adrian Klaver 
>An:thomas.deboben@rohde-schwarz.com, pgsql-general@postgresql.org
>Datum: 19.12.2016 19:05
>Betreff:   Re: [GENERAL] Windows installation - could not connect to 
server: Connection refused (0x274D/10061)
>
>On 12/16/2016 07:01 AM, thomas.deboben@rohde-schwarz.com wrote:
>>>Von:Adrian Klaver 
>>>An:thomas.deboben@rohde-schwarz.com,
>> pgsql-general@postgresql.org
>>>Datum:09.12.2016 22:21
>>>Betreff:Re: [GENERAL] Windows installation - could not connect
>> to server: Connection refused (0x274D/10061)
>>>
>
 This has worked for different version, but now we get sometimes 
trouble
>>>
>>>Which version did it work on?
>> I'm working with PostgreSQL 9.5.0.1.
>> We download the Win x86-32 and Win x86-64 installation packages from
>> 
http://www.enterprisedb.com/products-services-training/pgdownload#windows
>
>That is what you are using now but what where you using when, from first 
>post:
>
>"This has worked for different version, but now we get sometimes trouble 
>..."
>
I ment different versions fo our product.
But I had also installer including PostgreSQL 9.3.4.1, 9.3.6.1 and 
9.4.4.3.

 So far I wasn't able to reproduce this error by my self, but I know 
from
 about 5 issues inside the last month.
 As I'm not able to reproduce I would appreciate any help from you to
 find out what causes this error.
>>>
>>>The error is pretty straight forward the server cannot be found at
>>>localhost on port 5432, so:
>> Yes we use the standard port 5432
>>
>>>1) Do you know that the server is actually up and running at the point
>>>you run the scripts?
>> Atually I havn't really checked when the installer will start the 
service.
>> And as I said, I'm not able to get this error reproduced.
>
>Seems it would be helpful to put something in the script to check the 
>server status and log it before trying to connect to it.

How can I check the server status?
Is this simply if the postgres service is running, or if some sql command 
can connect the postgres port?

>>>
>>>2) Is the server listening on port 5432?
>> Yes.
>>>
>>>3) Is Windows properly mapping localhost?
>> Yes.
>>
>> When I got remote access to these machines after some time
>> the service was running and I could lauch the sql script from pgAdmin
>> without any problem.
>
>To me indicates this is an order of execution issue. The script is 
>running the connect/create scripts before the server is up and available 
>for connections.
>

But the first failing call is inside the original PostgreSQL installer 
package,
where I have no influence on.
So already here is the problem.

This is from bitrock_installer.log
...
[14:58:49] Installing the adminpack module in the postgres database...
Executing C:\Program Files\PostgreSQL\9.5\bin\psql.exe -c "CREATE 
EXTENSION adminpack" -d postgres
Script exit code: 2
...

But the lines above seems to be fine
...
Starting the database server...
Executing cscript //NoLogo "C:\Program 
Files\PostgreSQL\9.5\installer\server\startserver.vbs" postgres
Script exit code: 0

Script output:
 Starting postgres
Service postgres started successfully
startserver.vbs ran to completion
...
>>
>>>
 All installations do run on Windows 7 Pro x64.

 Best regards,
Thomas Deboben
>>>
>>>
>>>--
>>>Adrian Klaver
>>>adrian.kla...@aklaver.com
>>
>> Many thanks,
>>   Thomas
>-- 
>Adrian Klaver
>adrian.kla...@aklaver.com

Thanks,
 Thomas

[GENERAL] Indexes and loops or some kind of pg error?

2016-12-27 Thread Арсен Арутюнян
Hello.
I have a few questions:
1)  JobStatusTest1 function has only one request and JobStatusTest2 function 
has as many as six requests.
Why function JobStatusTest2 is faster? 

JobStatusTest1 : 981.596 ms
JobStatusTest2 : 849.133 ms

2) Two functions JobStatusTest3 and JobStatusTest4 perform the same actions. 
But one of the function performs the same steps in the cycle.
Why is the speed of the functions so incredibly much different?

JobStatusTest3 : 1430.777 ms
JobStatusTest4 : 2.386 ms

best
Arsen Arutyunyan

bugreport.sql
Description: Binary data

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