Re: [GENERAL] passing text value with single quote to stored procedure

2013-07-13 Thread Alban Hertroys
On Jul 13, 2013, at 24:05, Prabhjot Sheena  
wrote:

> when this value is passed to the function 
> 
> select load_stage_start_v1('QA_SUMMER'2013_(EU/US)');
> 
> This gives an error. Is there a way to fix this issue.

Your issue has nothing to do with stored procedures. You need to escape the 
string properly for SQL.

select load_stage_start_v1('QA_SUMMER''2013_(EU/US)');


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] [HACKERS] Frontend/backend protocol improvements proposal (request).

2013-07-13 Thread Dmitriy Igrishin
2013/6/28 Albe Laurenz 

> Dmitriy Igrishin wrote:
> >> Since there can be only one unnamed prepared statement per
> >> session, there should be only one such object per connection.
> >> It should not get deallocated; maybe it could be private to the
> >> connection, which only offers a "parseUnnamed" and "executeUnnamed"
> >> mathod.
> >
> > More precisely, there can be only one uniquely named prepared statement
> (named
> > or unnamed) per session.
> > Could you provide a signature of parseUnnamed and executeUnnamed please?
> > I don't clearly understand this approach.
>
> I'm just brainstorming.
> I'm thinking of something like
> void Connection::prepareUnnamed(const char *query,
>  int nParams,
>  const Oid *paramTypes);
> and
> Result Connection::executeUnnamed(int nParams,
>  const char * const *paramValues,
>  const int *paramLengths,
>  const int *paramFormats,
>  int resultFormat);
>
> But I'm not saying that this is the perfect solution.
>
I see. It's more like C-styled design, but not C++.

>
> >> If you really want your users to be able to set prepared statement
> >> names, you'd have to warn them to be careful to avoid the
> >> problem of name collision -- you'd handle the burden to them.
> >> That's of course also a possible way, but I thought you wanted
> >> to avoid that.
> >
> > The mentioned burden is already handled by backend which throws
> > duplicate_prepared_statement (42P05) error.
>
> I mean the problem that you create a prepared statement,
> then issue "DEALLOCATE stmt_name" create a new prepared statement
> with the same name and then use the first prepared statement.
>
I see. But I see no problem to invalidate localy allocated descriptors
of the remote prepared statements

>
> >>> Prepared_statement* pst1 = connection->describe("name");
> >>> Prepared_statement* pst2 = connection->describe("name"); // pst2
> points to the same remote
> >>> object
> >>
> >> That seems like bad design to me.
> >> I wouldn't allow different objects pointing to the same prepared
> >> statement.  What is the benefit?
> >> Shouldn't the model represent reality?
> >
> > Well, then the C and C++ languages are bad designed too, because they
> > allow to have as many pointers to the same as the user like (needs) :-)
>
> That's a different thing, because all these pointers contain the same
> value.  So if pst1 and pst2 represent the same object, I'd like
> pst1 == pst2 to be true.
>
IOW, you want to map localy allocated object to the remote one.
Or course, it is possible. But I dislike approach, since:
  a) objects pointed by pst* should be owned by the Connection instance;
  b) these objects may have its own state depending on the application
 context (e.g., different valuess binded, result format settings etc
etc.)
 but it will be impossible due to a).
BTW, according to 18.6.3.1 of "The C++ Programming Language" by Stroustrup,
"The default meaning of < and == for pointers are rarely useful as
comparison criteria
for the objects pointed to." So, I believe that you means that you'd like
*pst1 == *pst2. And yes, I'll agree with it.

>
> > Really, I don't see bad design here. Describing prepared statement
> > multiple times will results in allocating several independent
> descriptors.
>
> ... but for the same prepared statement.
>
> > (As with, for example, performing two SELECTs will result in allocating
> > several independent results by libpq.)
>
> But those would be two different statement to PostgreSQL, even if the
> query strings are identical.
>
> Mind you, I'm not saying that I am the person that decides what is
> good taste and what not, I'm just sharing my sentiments.
>
Don't worry, I'm mature enough to understand this :-) And thank you
for you suggestions!

>
> >> Of course an error during DEALLOCATE should be ignored in that case.
> >> It's hard to conceive of a case where deallocation fails, but the
> >> connection is fine.  And if the connection is closed, the statement
> >> will be deallocated anyway.
> >
> > Why this error should be ignored? I believe that this should be decided
> by the user.
> > As a library author I don't know (and cannot know) how to react on such
> errors
> > in the end applications.
>
> Again, I would say that that is a matter of taste.
> I just cannot think of a case where this would be important.
>
Maybe, but I'm firmly belive, that errors, provoked by the user, should
not be ignored at all. This is a one of design principles of my library.

>
> >>> Btw, by the reason 2) there are no any transaction RAII classes as in
> some other libraries,
> >>> because the ROLLBACK command should be executed in the destructor and
> may throw.
> >>
> >>  I tend to believe that such errors could also be ignored.
> >>  If ROLLBACK (or anything else) throws an error, the transaction
> will
> >>  get rolled back anyway.
> >
>

Re: [GENERAL] Build RPM from Postgres Source

2013-07-13 Thread James B. Byrne

> Date: Fri, 12 Jul 2013 14:37:19 -0700 (PDT)
> From: ktewari1 
> To: pgsql-general@postgresql.org
> Subject: Build RPM from Postgres Source
> Message-ID: <1373665039319-5763633.p...@n5.nabble.com>
>
> Hi,
> I need to have some different settings(like NAMEDATALEN  etc.)
> and that's why I'm trying to build postgres from the source and to
> create an rpm to be send for install.
>
> Now, the build works fine but, I don't see a way to create an RPM.
>
> I'll greatly appreciate any help.
>
> Thanks,
> Kul

You should take a look at mock,
http://fedoraproject.org/wiki/Projects/Mock.  I wrote up a short intro
to this a little while ago. You can read it here:
http://byrnejb.wordpress.com/2013/01/30/building-ruby-1-9-3-for-centos-6-3/

Although the example is not postgresql the process remains much the
same on any RHEL derived distro regardless of the package.

Good luck.


-- 
***  E-Mail is NOT a SECURE channel  ***
James B. Byrnemailto:byrn...@harte-lyne.ca
Harte & Lyne Limited  http://www.harte-lyne.ca
9 Brockley Drive  vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada  L8E 3C3



-- 
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] Re: pg_upgrade could not create catalog dump while upgrading from 9.0 to 9.2

2013-07-13 Thread Adrian Klaver

On 07/12/2013 11:25 PM, shankar.kotamar...@gmail.com wrote:

Thanks Adrian for your reply. You were right i am using Enterprise DB
version for 9.2 and community version for 9.0. I am including the
screenshot


From what I can tell the community version of 9.2 does not have the 
same fields as you show for the EDB version. They seem to be an addition 
on the part of EDB. You will probably to need to contact the folks at 
EDB on this to see if there is a way to have pg_upgrade make the 
transition or if they have an alternate tool.



--
Adrian Klaver
adrian.kla...@gmail.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] Re: pg_upgrade could not create catalog dump while upgrading from 9.0 to 9.2

2013-07-13 Thread Adrian Klaver

On 07/12/2013 11:25 PM, shankar.kotamar...@gmail.com wrote:

Thanks Adrian for your reply. You were right i am using Enterprise DB
version for 9.2 and community version for 9.0. I am including the
screenshot


To follow up on my previous post, I do not use Enterprise DB, but a 
little digging leads me to believe you will need to use the EDB 
Migration Toolkit:


http://www.enterprisedb.com/docs/en/9.2/migrate/Table%2520of%2520Contents.htm


I base this on the following comment:

http://www.enterprisedb.com/docs/en/9.2/migrate/Postgres_Plus_Migration_Guide-06.htm#P98_9775

"Migration Toolkit also allows you to migrate between Advanced Server 
and PostgreSQL."



--
Adrian Klaver
adrian.kla...@gmail.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] initdb of pg 9.0.13 fails on pg_authid

2013-07-13 Thread snark
Sorry, gcc-4.7 and "make clean" solved the problem.



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/initdb-of-pg-9-0-13-fails-on-pg-authid-tp5750773p5763679.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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