Em 7 de abril de 2017 12:36, Patrick B <patrickbake...@gmail.com> escreveu:
> Oi pessoal, tudo bem? > > Eu tenho a coluna (seg_table.path_name character varying(255), onde eu > armazeno o caminho do arquivo (pdf ou jpg) no S3bucket. > > Exemplo: > >> /{s3bucket}/filesuser/client/27801123/attachment/4510/main >> > /{s3bucket}/filesuser/client/27801123/attachment/4510/file > > > Eu preciso, num INNER JOIN, selecionar bem específico o 'main', talvez > algo assim? > > ... > FROM path_view n > INNER JOIN seg_table AS s ON s.path_name = substr(n.path_name, char_pos > '/file..' to get /filesuser/client/.../attachment/.../) || 'main' > > > > Mas não estou conseguindo.. poderiam me ajudar com a string? Obrigado! > Patrick. > Melhorando a explicação... Os caminhos que informei... /{s3bucket}/filesuser/client/27801123/attachment/4510/main > /{s3bucket}/filesuser/client/27801123/attachment/4510/file ... pode se tornar: /{s3bucket}/filesuser/client/27801123/attachment/4510/main > /111/small/photo.jpg > /{s3bucket}/filesuser/client/2 > 7801123/attachment/4510/file/111/medium/photo.jpg onde... 27801123 = account_id > 4510 = id > file | main = type > small | medium = variation > photo.jpg = filename /{s3bucket}/filesuser/client/27801123/attachment/4510/main é o caminho root de /{s3bucket}/filesuser/client/27801123/attachment/4510/main /111/small/photo.jpg. Mas eu preciso por numa where clause somente quando for = 'main' exemplo > select REGEXP_REPLACE(path_name, '.*/', '') as col2 from seg_table limit > 10; isso me retorna: > photo.jpg > main > file Está funcionando.. eu consigo selecionar o main. Mas como vocês podem ver, não seleciono só o 'main'. Como acrescentar isso numa where clause? Como por exemplo: WHERE REGEXP_REPLACE(path_name, '.*/', '')::text = 'main' Obrigado! Patrick.
_______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral