David G Johnston wrote
Medhavi Mahansaria wrote
Hi Bill,
Thanks!
But savepoint concept will not work for me as desired.
Is there any other way apart from SAVEPOINT that can be incorporated.
I am not using a script. I am writing a c++ program.
My problem is that I have 2
i want to select based on input, but if input is not provided or if
input is empty, then i want to select all rows.
1 select *
2 from table
3 if input = '' then
4 where true
5 else
6 where input = '$sanitized_variable'
7 end if;
(syntax error at 3)
i also looked at 'case' but i don't think it
Hello, i have created a function (in C) that receives an array that
contains tuples of ID's and values.
The function is to execute updates on each ID assigning the value, but if
one of these operation fails (does not meet certain criteria)
inside the function i would like to rollback and leave
i want to select based on input, but if input is not provided or if
input is empty, then i want to select all rows.
I think you can just use OR:
SELECT *
FROMtable
WHERE (input = '' OR input = ?)
This is assuming that `input` is a column in your table and ? is the
user input, based
On 2/19/2015 12:39 PM, zach cruise wrote:
i want to select based on input, but if input is not provided or if
input is empty, then i want to select all rows.
(metalanguage) if input is provided, then query(SELECT stuff FROM
table WHERE whatever = $INPUT)
The function is to execute updates on each ID assigning the value, but if
one of these operation fails (does not meet certain criteria)
inside the function i would like to rollback and leave everything
untouched, in case other ID;s were already updated previously,
and come back to the caller
Hi Thanks Chris, yes i have already tested ereport and even made up my own
sql state to report and error but from the application i can not access
this error code directly (through the PQexec,PQresultErrorField,etc
functions because the PGresult returns NULL) but i have to register a
callback
On 19 Feb 2015, at 21:39, zach cruise zachc1...@gmail.com wrote:
i want to select based on input, but if input is not provided or if
input is empty, then i want to select all rows.
1 select *
2 from table
3 if input = '' then
4 where true
5 else
6 where input =
On Wed, Feb 18, 2015 at 10:34:33AM -0500, Tom Lane wrote:
Brian Sutherland br...@vanguardistas.net writes:
If I run this set of commands against PostgreSQL 9.4.1 I pg_restore
throws an error with a permission problem. Why it does so is a mystery
to me, given that the user performing the
On Thu, Feb 19, 2015 at 11:11:59AM +0530, Medhavi Mahansaria wrote:
But savepoint concept will not work for me as desired.
I don't see why not.
Case 1: When Q2 fails (we delete the error), i want to continue to Q3 and
commit changes done by Q1 and Q3 once Q3 has executed successfully.
On Thu, 19 Feb 2015 11:12:38 +0530
Medhavi Mahansaria medhavi.mahansa...@tcs.com wrote:
Hi Bill,
Thanks!
But savepoint concept will not work for me as desired.
Why not? The scenerio you describe below can be perfectly implemented
using savepoints. Describe in more detail, please, why
On 02/19/2015 10:19 AM, brian wrote:
On Thu, 19 Feb 2015 09:30:57 -0700, you wrote:
On 02/19/2015 09:10 AM, brian wrote:
Hi folks,
I have a single-user application which is growing beyond the
fixed-format data files in which it currently holds its data, I need a
proper database as the
Thanks, Alvaro,
Yes indeed. I have a test that causes the deadlock almost immediately.
I have upgraded to 9.3.6 and have been running for a few hours now w/o
deadlock errors observed.
Dmitry
From: Alvaro Herrera [alvhe...@2ndquadrant.com]
Sent:
sorry, corrected below:
1 select *
2 from table
3 if '$sanitized_variable' = '' then -- $variable not provided or
undefined or empty,
4 where true -- so select every row/record
5 else
6 where input = '$sanitized_variable' -- variable provided or defined
or not-empty, so select only matching
Juan Pablo L wrote:
Hello, i have created a function (in C) that receives an array that
contains tuples of ID's and values.
Why are you writing a C function? Sounds like you could accomplish the
same with a plpgsql function, with much less effort.
The function is to execute updates on each
Thank you Alvaro, i m afraid ereport seems to be the way, that it is
complicated to catch this error code in the code of the caller. cause you
have to use a callback etc etc
On 19 February 2015 at 15:57, Alvaro Herrera alvhe...@2ndquadrant.com
wrote:
Juan Pablo L wrote:
Hi, i want previous
On 2/19/2015 12:39 PM, zach cruise wrote:
i want to select based on input, but if input is not provided or if
input is empty, then i want to select all rows.
something unclear here, is INPUT a variable in your application program,
or is it a field in the table?
--
john r pierce
Hi, i want previous updates to rollback ... like nothing happened (a normal
begin/rollback behaviour)
On 19 February 2015 at 15:34, Alvaro Herrera alvhe...@2ndquadrant.com
wrote:
Juan Pablo L wrote:
Hello, i have created a function (in C) that receives an array that
contains tuples of ID's
Juan Pablo L wrote:
Hi, i want previous updates to rollback ... like nothing happened (a normal
begin/rollback behaviour)
Ah, so ereport() is exactly what you want, like Chris Mair said.
Assuming you wrote it correctly, you should see the ERROR line in the
server logs (set
On 2/19/2015 1:41 PM, Juan Pablo L wrote:
Hi, i want previous updates to rollback ... like nothing happened (a
normal begin/rollback behaviour)
so thrown an exception. The actual rollback has to be invoked by the
client application program, which should catch the error thrown by the
query
On 2/19/2015 2:02 PM, Juan Pablo L wrote:
Thank you Alvaro, i m afraid ereport seems to be the way, that it is
complicated to catch this error code in the code of the caller. cause
you have to use a callback etc etc
a query that triggers ereport(ERROR,) should return a PGresult* that
you
Thank you, i will try this, honestly i was checking if PGResult is NULL,
when i trigger the exception i always get NULL so i did not any further but
i will try this .
On 19 February 2015 at 16:22, John R Pierce pie...@hogranch.com wrote:
On 2/19/2015 2:02 PM, Juan Pablo L wrote:
Thank you
zach cruise wrote
sorry, corrected below:
1 select *
2 from table
3 if '$sanitized_variable' = '' then -- $variable not provided or
undefined or empty,
4 where true -- so select every row/record
5 else
6 where input = '$sanitized_variable' -- variable provided or defined
or not-empty,
i tried this but the call to PQresultErrorField(PGresult, PG_DIAG_SQLSTATE)
is returning NULL, this is what trigger the exception in the function code:
ereport(ERROR,(errcode(ERRCODE_SQL_ROUTINE_EXCEPTION),errmsg(Plan with id
%s does not allow balance with id %s,plan_id,in_balanceid)));
and this
Ken Tanzer wrote
ag_reach_test= INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}';
ERROR: column my_array is of type character varying[] but expression is
of type text
LINE 1: INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}';
^
HINT:
2015-02-20 1:57 GMT+01:00 inspector morse inspectormors...@gmail.com:
In all other DBMS, the variable names have a distinctive character to
differentiate between variables and column names:
Example:
SQL Server uses @
MySql uses ?
Oracle uses :
Firebirdsql uses :
It makes it easier to
Hi. Here's a boiled down example of something that caught me by surprise:
ag_reach_test= CREATE TEMP TABLE foo (my_array varchar[]);
CREATE TABLE
ag_reach_test= INSERT INTO foo (my_array) SELECT '{TEST}';
INSERT 0 1
ag_reach_test= SELECT my_array[1],array_length(my_array,1) FROM foo;
my_array |
On 02/19/2015 04:57 PM, inspector morse wrote:
In all other DBMS, the variable names have a distinctive character to
differentiate between variables and column names:
Example:
SQL Server uses @
MySql uses ?
Oracle uses :
Firebirdsql uses :
It makes it easier to write and manage queries
Hi folks,
I have a single-user application which is growing beyond the
fixed-format data files in which it currently holds its data, I need a
proper database as the backend. The front end is written using Lazarus
and FreePascal under Linux, should anyone feel that makes a
difference. The
You should consider a BitString.
http://www.postgresql.org/docs/9.4/static/datatype-bit.html
On Thu, Feb 19, 2015 at 11:10 AM, brian br...@meadows.pair.com wrote:
Hi folks,
I have a single-user application which is growing beyond the
fixed-format data files in which it currently holds its
On 02/19/2015 09:10 AM, brian wrote:
Hi folks,
I have a single-user application which is growing beyond the
fixed-format data files in which it currently holds its data, I need a
proper database as the backend. The front end is written using Lazarus
and FreePascal under Linux, should anyone
On Thu, Feb 19, 2015 at 2:14 PM, Brian Dunavant br...@omniti.com wrote:
You should consider a BitString.
http://www.postgresql.org/docs/9.4/static/datatype-bit.html
On Thu, Feb 19, 2015 at 11:10 AM, brian br...@meadows.pair.com wrote:
Hi folks,
I have a single-user application which
Thank you all so much for the feedback.
At this point, I'm convinced that the issue is more complicated than I
originally thought :)
FWIW, my use case is for a company internal database. I open the database
up to all users by simply having a readonly user that anyone can use to
connect to the
Hi Adrian,
On Wed, Feb 18, 2015 at 10:25 PM, Adrian Klaver
adrian.kla...@aklaver.com wrote:
On 02/16/2015 02:44 AM, Novák, Petr wrote:
Hello,
sorry for posting to second list, but as I've received no reply
there, I'm trying my luck here.
Thanks
Petr
-- Forwarded message
Hi Dinesh
On Wed, Feb 18, 2015 at 11:01 PM, dinesh kumar dineshkuma...@gmail.com wrote:
Hi,
On Mon, Feb 16, 2015 at 2:44 AM, Novák, Petr nov...@avast.com wrote:
Hello,
sorry for posting to second list, but as I've received no reply
there, I'm trying my luck here.
Thanks
Petr
On 02/19/2015 01:46 AM, Daniel LaMotte wrote:
Thank you all so much for the feedback.
At this point, I'm convinced that the issue is more complicated than I
originally thought :)
FWIW, my use case is for a company internal database. I open the
database up to all users by simply having a
On Thu, 19 Feb 2015 09:30:57 -0700, you wrote:
On 02/19/2015 09:10 AM, brian wrote:
Hi folks,
I have a single-user application which is growing beyond the
fixed-format data files in which it currently holds its data, I need a
proper database as the backend. The front end is written using
Brian Sutherland br...@vanguardistas.net writes:
On Wed, Feb 18, 2015 at 10:34:33AM -0500, Tom Lane wrote:
User nobody does not have permission to read table x, so the REFRESH
fails, because the view's query executes as the view's owner.
If you grant select permission for the user nobody on
Thank you, that was helpful.
In the pg_replication_slots view, I see that xmin is always NULL, is that
expected? I'm not sure how to measure the BDR update latency without this xmin
value.
If I run pg_get_transaction_committime(catalog_xmin), sometimes I get what
looks like a default time
inspector morse inspectormors...@gmail.com writes:
In all other DBMS, the variable names have a distinctive character to
differentiate between variables and column names:
Example:
SQL Server uses @
MySql uses ?
Oracle uses :
Firebirdsql uses :
It makes it easier to write and manage
In all other DBMS, the variable names have a distinctive character to
differentiate between variables and column names:
Example:
SQL Server uses @
MySql uses ?
Oracle uses :
Firebirdsql uses :
It makes it easier to write and manage queries especially in stored
procedures.
Just compare the
Yeah, I'm using plpgsql.
Actually nevermind on this. I was able to patch my data access utility so
it adds a prefix when calling the stored function and then remove it again
before returning for front end processing.
On Thu, Feb 19, 2015 at 8:44 PM, Adrian Klaver adrian.kla...@aklaver.com
wrote:
inspector morse inspectormors...@gmail.com writes:
Is there any plan to add a character to differentiate between variables?
No. You're free to use a naming convention yourself, of course, but
we're not going to break every stored procedure in sight in order
to impose one.
43 matches
Mail list logo