2006/12/27, Dave Page <[EMAIL PROTECTED]>:
Clodoaldo wrote:
> 2006/12/23, Clodoaldo <[EMAIL PROTECTED]>:
>> When a function is selected in the object browser the function's
>> create script is shown in the properties tab meshed with the
>> properties values.
>>
>> This happens in both 1.6.1 and 1.7.0 with wxGTK 2.8.0. It did not
>> happen in 1.4.x with wxGTK 2.6.
>>
>> As I think it is hard to visualize I took a screenshot (127 KB):
>> http://fahstats.com/img/pgadmin_bug.png
>>
>> I'm using FC5 i386, wxGTK 2.8.0 and the Gnome desktop.
>>
>
> Also happens in the Constraints tab of the table properties window (37KB):
> http://fahstats.com/img/pgadmin_bug1.png
I suspect this is a rendering bug in the underlying listview control
that shows up when pgAdmin puts multiline data in there. Should be easy
to fix by chopping the text at the first \n (or replacing them with
spaces), but out of curiosity, can you resize that row to display it
properly?
I'm not sure what you mean by "resize that row". I made everything
bigger and took other screenshots (169 KB):
http://fahstats.com/img/pgadmin_bug2.png
and 76 KB:
http://fahstats.com/img/pgadmin_bug3.png
These are the create function and the create table scripts in case it
has any value:
-- Function: valida_cpf(cpf bpchar)
-- DROP FUNCTION valida_cpf(cpf bpchar);
CREATE OR REPLACE FUNCTION valida_cpf(cpf bpchar)
RETURNS boolean AS
$BODY$def dvpf(cpf):
soma = 0
for i, x in enumerate(cpf):
soma += int(x) * spf1[i]
resto = soma % 11
if resto < 2: dv1 = '0'
else: dv1 = str(11 - resto)
soma = 0
for i, x in enumerate(cpf + dv1):
soma += int(x) * spf2[i]
resto = soma % 11
if resto < 2: dv2 = '0'
else: dv2 = str(11 - resto)
return dv1 + dv2
spf1 = (10,9,8,7,6,5,4,3,2)
spf2 = (11,10,9,8,7,6,5,4,3,2)
if len(cpf) != 11 \
or cpf is None \
or cpf in (
'11111111111','22222222222','33333333333',
'44444444444','55555555555','66666666666',
'77777777777','88888888888','99999999999'):
return False
if dvpf(cpf[0:9]) == cpf[9:11]:
return True
return False$BODY$
LANGUAGE 'plpythonu' IMMUTABLE STRICT;
ALTER FUNCTION valida_cpf(cpf bpchar) OWNER TO cpn;
-- Table: vendedor
-- DROP TABLE vendedor;
CREATE TABLE vendedor
(
nome_usuario character varying(20) NOT NULL,
nome_completo character varying(100) NOT NULL,
estado_sigla character(2) NOT NULL,
localidade_id smallint NOT NULL,
bairro_id integer NOT NULL,
email character varying(150) NOT NULL,
cpf character(11) NOT NULL,
id serial NOT NULL,
ip inet,
data timestamp with time zone DEFAULT now(),
CONSTRAINT vendedor_pkey PRIMARY KEY (cpf),
CONSTRAINT vendedor_bairro_id_fkey FOREIGN KEY (bairro_id)
REFERENCES bairro (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT vendedor_estado_sigla_fkey FOREIGN KEY (estado_sigla)
REFERENCES estado (estado_sigla) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT vendedor_localidade_id_fkey FOREIGN KEY (localidade_id)
REFERENCES localidade (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT vendedor_id_key UNIQUE (id),
CONSTRAINT vendedor_cpf_check CHECK (cpf ~ '[0-9]{11}'::text AND
valida_cpf(cpf)),
CONSTRAINT vendedor_email_check CHECK (email::text ~ '[EMAIL PROTECTED]'::text)
)
WITHOUT OIDS;
ALTER TABLE vendedor OWNER TO cpn;
GRANT ALL ON TABLE vendedor TO cpn;
GRANT SELECT ON TABLE vendedor TO car;
-- Index: lower_nome_usuario
-- DROP INDEX lower_nome_usuario;
CREATE UNIQUE INDEX lower_nome_usuario
ON vendedor
USING btree
(lower(nome_usuario::text));
Regards,
--
Clodoaldo Pinto Neto
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq