How to create string concatenation operator which preserves trailing spaces
on CHAR(n) type columns ?
I tried code below, but it returns AB (without spaces).
How to force it to return A B (keep space after A) ?
Andrus.
CREATE OR REPLACE FUNCTION public.stringconcat(left text, right text)
RETURN
Andrus wrote:
> How to create string concatenation operator which preserves trailing spaces
> on CHAR(n) type columns ?
>
> I tried code below, but it returns AB (without spaces).
> How to force it to return A B (keep space after A) ?
>
> Andrus.
>
> CREATE OR REPLACE FUNCTION public.stringconca
Hi!
Use "bpchar" instead of "text" in the definition of function and operator.
Otherwise col1 gets cast to "text" and loses its trailing spaces.
Thank you very much.
It worked.
Which notation to use for this ?
Is it reasonable use "+" as such operator for strings or should some other
notatio
Andrus wrote:
>> Use "bpchar" instead of "text" in the definition of function and operator.
>> Otherwise col1 gets cast to "text" and loses its trailing spaces.
>
> Thank you very much.
> It worked.
> Which notation to use for this ?
>
> Is it reasonable use "+" as such operator for strings or sh
On 07/28/2014 09:33 PM, Tobias Fielitz wrote:
Hi,
I am trying to start pgbouncer via upstart script. The upstart logs
(/var/log/upstart/pgbouncer.log) tell me:
/var/run/postgresql/pgbouncer.pid: No such file or directory [2]
but when starting pgbouncer from the console with:
> sudo service pg
Hello!
Is it possible to detect what master transaction is visible on standby?
I try to use txid_current_snapshot() but it return wrong result on standby:
_master_:
create table tmp.txid_test(txid bigint, ss txid_snapshot)
begin;
insert into tmp.txid_test values (txid_current(), txid_current_snap
A couple months ago we upgraded the RAM on our database servers from 48GB
to 64GB. Immediately afterwards the new RAM was being used for page cache,
which is what we want, but that seems to have dropped off over time, and
there's currently actually like 12GB of totally unused RAM.
http://s76.phot
Greetings,
I want to call a function using a column of a table as the parameter and
return the parameter and function results together.
The problem is, when the function returns an empty row my select statement
that uses the function returns an empty row as well.
The following simplified snippet d
Hello
you can try
world=# CREATE OR REPLACE FUNCTION xx(int)
world-# RETURNS TABLE(a int, b int) AS
world-# $$ SELECT $1, $1 WHERE $1 = 1 UNION ALL SELECT NULL, NULL LIMIT 1;
$$
world-# LANGUAGE sql;
CREATE FUNCTION
Time: 74.320 ms
world=# SELECT * FROM xx(1);
a | b
---+---
1 | 1
(1 row)
Time:
Seref Arikan wrote
> select 1,test_empty_row(1);
SELECT 1, (SELECT test_empty_row(1)) AS func_result
You can also adjust the function to either return the result of the query OR
"RETURN NULL" if no results were found. i.e., do not use "RETURN QUERY"
David J.
--
View this message in cont
On Wed, Jul 30, 2014 at 12:51 PM, Kevin Goess wrote:
> A couple months ago we upgraded the RAM on our database servers from 48GB to
> 64GB. Immediately afterwards the new RAM was being used for page cache,
> which is what we want, but that seems to have dropped off over time, and
> there's curren
Seref Arikan writes:
> I want to call a function using a column of a table as the parameter and
> return the parameter and function results together.
> The problem is, when the function returns an empty row my select statement
> that uses the function returns an empty row as well.
This function i
Good suggestion, but nope, that ain't it:
$ cat /proc/sys/vm/zone_reclaim_mode
0
On Wed, Jul 30, 2014 at 11:49 AM, Merlin Moncure wrote:
> On Wed, Jul 30, 2014 at 12:51 PM, Kevin Goess wrote:
> > A couple months ago we upgraded the RAM on our database servers from
> 48GB to
> > 64GB. Immedi
Pavel, thank you so much. This did the trick!
On Wed, Jul 30, 2014 at 7:18 PM, Pavel Stehule
wrote:
> Hello
>
> you can try
>
> world=# CREATE OR REPLACE FUNCTION xx(int)
> world-# RETURNS TABLE(a int, b int) AS
> world-# $$ SELECT $1, $1 WHERE $1 = 1 UNION ALL SELECT NULL, NULL LIMIT 1;
> $$
On Wed, Jul 30, 2014 at 12:57 PM, Kevin Goess wrote:
> On Wed, Jul 30, 2014 at 11:49 AM, Merlin Moncure wrote:
>> On Wed, Jul 30, 2014 at 12:51 PM, Kevin Goess wrote:
>> > A couple months ago we upgraded the RAM on our database servers from
>> > 48GB to
>> > 64GB. Immediately afterwards the new
Hi David,
Thanks for the feedback. I've actually tried to do what you've suggested,
but I always found myself unable to do the check for empty result for query
in an elegant way.
That is, I end up thinking about creating a temp table to put the query
results in (which can be > 1), then check if the
Merlin Moncure wrote:
> On Wed, Jul 30, 2014 at 12:51 PM, Kevin Goess wrote:
>
>> A couple months ago we upgraded the RAM on our database servers from 48GB to
>> 64GB. Immediately afterwards the new RAM was being used for page cache,
>> which is what we want, but that seems to have dropped off o
Thanks Tom,
The function can return multiple rows. It is a very simplified version of a
function that is used in the context of an EAV design.
It should return 0 or more rows that match the criteria that is calculated
in the function.
Originally I had a left outer join from the table that I'm usin
On Wed, Jul 30, 2014 at 1:05 PM, Kevin Grittner wrote:
> Merlin Moncure wrote:
>> On Wed, Jul 30, 2014 at 12:51 PM, Kevin Goess wrote:
>>
>>> A couple months ago we upgraded the RAM on our database servers from 48GB to
>>> 64GB. Immediately afterwards the new RAM was being used for page cache,
Hello all,
I've got two queries which should produce the same results but they don't
for some reason, please consider these :
SELECT date_trunc('day', payments.created_at) "day",
SUM("payments"."amount") AS sum_id FROM "payments"
INNER JOIN "users" ON "users"."id" = "payments"."user_id" WHERE
"
Emir Ibrahimbegovic wrote
> Hello all,
>
> I've got two queries which should produce the same results but they don't
> for some reason, please consider these :
>
> SELECT date_trunc('day', payments.created_at) "day",
> SUM("payments"."amount") AS sum_id FROM "payments"
> INNER JOIN "users" ON "
On Wed, Jul 30, 2014 at 8:41 PM, Emir Ibrahimbegovic <
emir.ibrahimbego...@gmail.com> wrote:
> Hello all,
>
> I've got two queries which should produce the same results but they don't
> for some reason, please consider these :
>
> SELECT date_trunc('day', payments.created_at) "day", SUM("payments"
We are trying to help a client, one of their databases was being backed
up via snapshots without running a pg_start_backup or pg_stop _backup
Recently they had an issue and they recovered from one of these snapshot
backups, which are now producing errors such as :
Invalid page header in block X
Hi everyone I read that 2ndQuadrant released bidirectional replication
for postgres,
know whether this package will enter apt.postgresql.org or if there will
be any repository
for Debian GNU / Linux?
thanks
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes
(Cross-posted to StackOverflow:
http://stackoverflow.com/questions/25041100/postgresql-user-defined-operator-function-what-parameter-type-to-use-for-uncast
)
I'm defining my own domain and a equality operator. I cannot cause
PostgreSQL to use my operator function in a query without explicitly
c
Adam Mackler-5 wrote
> (Cross-posted to StackOverflow:
> http://stackoverflow.com/questions/25041100/postgresql-user-defined-operator-function-what-parameter-type-to-use-for-uncast
> )
>
> I'm defining my own domain and a equality operator.
> Next I create an equality operator to do case-insensiti
I have played around with it a bit more, it seems adding the pre-start
section works:
pre-start script
if [ -d /var/run/postgresql ]; then
chmod 2775 /var/run/postgresql
else
install -d -m 2775 -o postgres -g postgres /var/run/postgresql
fi
end script
Thanks Adrian!
27 matches
Mail list logo