ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] PostgreSQL string functions
@ 2003-02-04  7:53 Grigory Batalov
  2003-02-04  7:57 ` Korshunov Ilya
  2003-02-05 10:17 ` Sergey Vlasov
  0 siblings, 2 replies; 3+ messages in thread
From: Grigory Batalov @ 2003-02-04  7:53 UTC (permalink / raw)
  To: community

Не знаю, куда вопрос задать, задам сюда.
Нужно делать выборку из логов в postgres-е по логинам, пока сделал так:

select sum(bytes) as bytes from squid_raw_log where time >= $time1 and time < $time2 and login ~ '$login$'

где $login задаётся в php.
Хочется выбирать сразу "login, sum(bytes) ... group by login",
но мешает существование логинов "user" и "domain\user", которые
суть одно и то же.

Собственно, вопрос:
Есть ли в postgres такая функция strstr, substr или им подобные,
чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
Или можно решить эту задачу другим способом?

P.S. Если кто знает специализированные конференции по postgres,
     ткните, плиз.
--
 Grigory Batalov


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] PostgreSQL string functions
  2003-02-04  7:53 [Comm] PostgreSQL string functions Grigory Batalov
@ 2003-02-04  7:57 ` Korshunov Ilya
  2003-02-05 10:17 ` Sergey Vlasov
  1 sibling, 0 replies; 3+ messages in thread
From: Korshunov Ilya @ 2003-02-04  7:57 UTC (permalink / raw)
  To: community

В сообщении от 4 Февраль 2003 10:53 Grigory Batalov написал:
> Не знаю, куда вопрос задать, задам сюда.
> Нужно делать выборку из логов в postgres-е по логинам, пока сделал
> так:
>
> select sum(bytes) as bytes from squid_raw_log where time >= $time1
> and time < $time2 and login ~ '$login$'
>
> где $login задаётся в php.
> Хочется выбирать сразу "login, sum(bytes) ... group by login",
> но мешает существование логинов "user" и "domain\user", которые
> суть одно и то же.
>
> Собственно, вопрос:
> Есть ли в postgres такая функция strstr, substr или им подобные,
> чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
> Или можно решить эту задачу другим способом?

не очень въехал в суть проблемы...

На всяк случай - 
pgsql-hackers@postgresql.org - это по самому серверу
pgsql-users@postgresql.org - туточки для пользователей

Все англоязычное.


-- 
Best Regards
Korshunov Ilya
JID: koshakp@jabber.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] PostgreSQL string functions
  2003-02-04  7:53 [Comm] PostgreSQL string functions Grigory Batalov
  2003-02-04  7:57 ` Korshunov Ilya
@ 2003-02-05 10:17 ` Sergey Vlasov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Vlasov @ 2003-02-05 10:17 UTC (permalink / raw)
  To: community

On Tue, 4 Feb 2003 10:53:18 +0300
Grigory Batalov <grisxa@mail.ru> wrote:

> Есть ли в postgres такая функция strstr, substr или им подобные,
> чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
> Или можно решить эту задачу другим способом?

Ну там же в пакете postgresql-docs документации море.

Первый вариант, пришедший в голову (для 7.3):

substring(login from '[^\\]*$')


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-05 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04  7:53 [Comm] PostgreSQL string functions Grigory Batalov
2003-02-04  7:57 ` Korshunov Ilya
2003-02-05 10:17 ` Sergey Vlasov

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git